Question
#include<stdio.h>
struct first
{
int a;
float b;
}s1={32760,12345.12345};
typedef struct
{
char a;
int b;
}second;
struct my_struct
{
float a;
usigned int b;
};
typedef struct my_struct third;
void main()
{
struct second s2={'A',- -4};
third s3;
s3.a=~(s1.a-32760);
s3.b=-++s2.b;
printf("%d %.2f\n%c %d\n%.2f %u",(s1.a)--,s1.b+0.005,s2.a+32,s2.b,++(s3.a),--s3.b);
}
What will be output if you compile following c code ?
#include<stdio.h>
struct first
{
int a;
float b;
}s1={32760,12345.12345};
typedef struct
{
char a;
int b;
}second;
struct my_struct
{
float a;
usigned int b;
};
typedef struct my_struct third;
void main()
{
struct second s2={'A',- -4};
third s3;
s3.a=~(s1.a-32760);
s3.b=-++s2.b;
printf("%d %.2f\n%c %d\n%.2f %u",(s1.a)--,s1.b+0.005,s2.a+32,s2.b,++(s3.a),--s3.b);
}
Answer: Option D
Was this answer helpful ?
Illustrating 3 different ways of declaring the structres : first, second and third are the user-defined structure type. s1, s2 and s3 are structure variables. Also an expression of the form ++variable.member is equivalent to ++(variable.member), i.e. ++ operator will apply to the structure member, not the entire structure variable.
Was this answer helpful ?
More Questions on This Topic :
Question 1.
How will you free the allocated memory ?
....
Submit Solution