- 1

Should a pointer contain variable address of same datatype ??

char a='h'; int b=&a; does this is correct??

3rd Sep 2017, 11:37 AM
Harsha Sanju
Harsha Sanju - avatar
2 Respuestas
+ 8
Nope. Pointer datatype has to be obeyed. You store the address of a character variable using a char pointer.
3rd Sep 2017, 1:01 PM
Hatsy Rei
Hatsy Rei - avatar
0
ok if I place *b=&a; then it is also wrong.... yes??
3rd Sep 2017, 1:42 PM
Harsha Sanju
Harsha Sanju - avatar