C Programming - Pointers - Discussion
Discussion Forum : Pointers - Find Output of Program (Q.No. 9)
9.
What will be the output of the program if the size of pointer is 4-bytes?
#include<stdio.h>
int main()
{
printf("%d, %d\n", sizeof(NULL), sizeof(""));
return 0;
}
Answer: Option
Explanation:
In TurboC, the output will be 2, 1 because the size of the pointer is 2 bytes in 16-bit platform.
But in Linux, the output will be 4, 1 because the size of the pointer is 4 bytes.
This difference is due to the platform dependency of C compiler.
Discussion:
27 comments Page 3 of 3.
Lakshmi Priya said:
7 years ago
Output is 4, 2 because " " is string not character.
Ravitheja.j said:
1 decade ago
@jack. Thanks for your valuable information.
Sheheryar izhar said:
7 years ago
Pointer size in 2 bytes in 16 bits.
Sunil kumar said:
1 decade ago
Can anyone explain this program ?
Rahul said:
9 years ago
Thanks a lot @Rahul Chauhan.
Rahul said:
1 decade ago
Thanks krishan.
Murthy said:
1 decade ago
What is null ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers