C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Find Output of Program (Q.No. 10)
10.
What will be the output of the program ?
#include<stdio.h>
int main()
{
struct byte
{
int one:1;
};
struct byte var = {1};
printf("%d\n", var.one);
return 0;
}
Discussion:
29 comments Page 2 of 3.
Ashok said:
1 decade ago
Here var is variable for struct byte type, here 1 is assigned to one (integer variable) ;.
Jagadesh said:
8 years ago
Hello everyone.
Anybody can explain what is the meaning for this statement int one:1;?
Anybody can explain what is the meaning for this statement int one:1;?
(2)
Prashant o_O said:
1 decade ago
int a;
a=1; means 0000000000000001
and
int a:1;
a=1; means 1000000000000001
a=1; means 0000000000000001
and
int a:1;
a=1; means 1000000000000001
Sushant Choudhary said:
1 decade ago
I would say A or B could be right depending upon the endianness of the system.
Devendra said:
1 decade ago
The output will not be -1 on little endian systems, as simple as that.
Pranav said:
1 decade ago
What is this line means here ?
struct byte var = {1};
struct byte var = {1};
Mahi said:
1 decade ago
Can anyone explain about the statement?
int one:1;
int one:1;
Archana said:
10 years ago
What is the difference between int a:1 and int a=1?
Rahul said:
1 decade ago
What is declaration just like int : what is this?
Priyanka said:
2 decades ago
Can any 1 explain me o/p of this question?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers