Discussion
If char=1, int=4, and float=4 bytes size, What will be the output of the program ?
#include <stdio.h>
int main()
{
char ch = 'A';
printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
return 0;
}
Answer: B
Correct answer: 1, 4, 4
sizeof(ch) is 1, the size of a char. sizeof('A') is 4, because a character constant in C has type int. And 3.14f carries the f suffix, making it a float, so 4 - without the suffix it would be a double.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development