C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 13)
13.
What will be the output of the program given below in 16-bit platform ?
#include<stdio.h>
int main()
{
enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var;
printf("%d\n", sizeof(var));
return 0;
}
Discussion:
50 comments Page 5 of 5.
Naga Mahesh said:
1 decade ago
enum always returns integer only so size is always 2 bytes
Sanoar said:
1 decade ago
In gcc linux platform answer is 4.
i.e. Answer is C.
i.e. Answer is C.
Rohini said:
1 decade ago
enum returns integer only so size is always 2 bytes.
Sridhar said:
1 decade ago
As it is an int type it gives 2 as answer.
Lovely said:
1 decade ago
Thanks sundar. Thank you very much.
Manisha said:
5 years ago
No, the right Answer should be 4.
Mohana said:
6 years ago
Well explained, thanks @Neha.
(1)
Satyaprakash said:
1 decade ago
Thanks to rohit.
Swe said:
1 decade ago
Thanks sundar.
Ashok said:
9 years ago
How it got 2?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers