I have used Code::blocks 12 compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
#include <stdio.h>
int main()
{
const int a=20; //declare and assign constant integer
int *p; //declare integer pointer
p=&a; //assign address into pointer p
printf("Before changing - value of a: %d",a);
//assign value using pointer
*p=40;
printf("\nAfter changing - value of a: %d",a);
printf("\nValue has changed.");
return 0;
}
I have used Code::blocks 12 compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
Result:
Before changing - value of a: 20
After changing - value of a: 40
Value has changed.
need an explanation for this answer? contact us directly to get an explanation for this answer