fork download
  1. #include<stdio.h>
  2.  
  3. void fun(const int *s)
  4. {
  5. printf("In this function %d\n",*s);
  6. }
  7.  
  8. int main()
  9. {
  10. const int a = 10;
  11. int *p = (int*)&a; // const int* to int*
  12. printf("before modification a=%d\n",a);
  13.  
  14. *(int*)&a = 12;
  15.  
  16. printf("after modification a=%d\n",a);
  17. printf("after modification p=%d\n",*p);
  18. fun(&a);
  19. //getch();
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
before modification a=10
after modification a=10
after modification p=12
In this function 12