S
shyju_kambi
when a 'const int ' is declared, where is it been created(in RAM?)
#include<stdio.h>
int main()
{
const int i=10;
const int *p;
p=&i;
*p=12;
printf("\n %d %d",i,*p);
return 0;
}
---------------------------------------------------------
the following program i tryied, still i was unable to change the value
of a const.
when a variable is declared, a ram location is allocated for it. then
why i cant change the value of that variable using pointer?
if the variable i've declared as a 'static int ' then using pointer i
can change the value.
plz give solutions
#include<stdio.h>
int main()
{
const int i=10;
const int *p;
p=&i;
*p=12;
printf("\n %d %d",i,*p);
return 0;
}
---------------------------------------------------------
the following program i tryied, still i was unable to change the value
of a const.
when a variable is declared, a ram location is allocated for it. then
why i cant change the value of that variable using pointer?
if the variable i've declared as a 'static int ' then using pointer i
can change the value.
plz give solutions