Interview Question 3533
Created by admin on Sat, 17/11/2012 - 12:19
Explanation:
The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer, which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof(p) gives 2.
Question:
main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}
Language:
Answer:
1 2