+ 1
I dont understand what is going on here and how output is coming 4500?
int main() { int *p; p=(int*)4500; printf("%d",p); return 0; }
9 Réponses
+ 2
Got u bro ~ swim ~ .
One more thing
int main()
{ int a=10;
char *p;
p=(char*)&a;
return 0;
}
This is also very confusing.
+ 1
So ~ swim ~ u mean that (int*) is the main player here? It is converting 4500 explicitly into address ?
0
~ swim ~ actually I did not understand that what is happening inside memory or to the address when
(char*)&a thus conversion is taking place.
0
I got u ~ swim ~ but by doing this (char*)&a . Now how it is dereferencing the data in variable a completely.
Since the data type of pointer decides how much data will be dereferenced.
When we have this
int a=10;
char *p;
p=&a;
I got your explanation that why data in a can't be dereferenced completely .
But when we write
p=(char*)&a;
Then what happens ? Now how that data is dereferencing completely.