Pointer and variable size in c/c++

int *p;
printf(“%d,%d”,sizeof(*p),sizeof(p));
float *p;
printf(“%d,%d”,sizeof(*p),sizeof(p));
double *p;
printf(“%d,%d”,sizeof(*p),sizeof(p));
long double*p;printf(“%d,%d”,sizeof(*p),sizeof(p));
Tutorial answer:
2 ,2
4,2
8,2
10,2
Debugging solution:
First it print variable size:
Int ->2
Float->4
Double->8
Long double->10
Every pointer it has size value 2 bytes.

Post a Comment

0 Comments