Constant pointer :
// in these way we can alter the value of x using pointer
#include <stdio.h>
int main()
{
const int x = 22;
int *p ;
p = &x;
*p = 155;
printf("%d is the value of x" , x);
return 0;
}
*********"""""***********"""""""*********
// in these way we can alter the value of *p using another pointer q;
#include <stdio.h>
int main()
{
const int x = 22;
const int *p ;
int *q;
p = &x;
//*p = 155;
q = &x;
*q= 200;
printf("%d is the value of x" , x);
return 0;
}
Comments
Post a Comment