Thank You all, that solved it completely. But now I have one more question. I tried the following code :
Code:
#include <stdio.h>
int main()
{
const int a=10;
int *b = &a;
*b=20;
printf("%d\n", a);
return 0;
}
when I compiled it, I got the following warning:
Code:
koodoo@knapsacker:~$ gcc prog.c -o prog
prog.c: In function `main':
prog.c:5: warning: initialization discards qualifiers from pointer target type
koodoo@knapsacker:~$
But when I executed it, I got the following result:
Code:
koodoo@knapsacker:~$ ./prog
20
koodoo@knapsacker:~$
How do I explain this now?