Home » C Programming » Floating Point Issues

What will be the output of the program? #include int main() { float *p; printf("%d\n", sizeof(p)); return 0; }

Correct Answer: 2 in 16bit compiler, 4 in 32bit compiler

Explanation:

sizeof(x) returns the size of x in bytes.
float *p is a pointer to a float.


In 16 bit compiler, the pointer size is always 2 bytes.
In 32 bit compiler, the pointer size is always 4 bytes.


← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion