Sail E0 Webinar
Question

What will be output if you compile following c code ?


#include<stdio.h>
struct values
{
int i;
float f;
};
void main()
{
struct values var={555,67.05501};
printf("%2d %.2f",var.i,var.f);
}


Options:
A .  Compile error
B .  55 67.05
C .  555 67.06
D .  555 67.05
Answer: Option C

The members of a structure variable can be assigned initial values in much the same manner as the elements of an array. The initial values must appear in order in which they will be assigned to their corresponding strucutre members, enclosed in braces and separated by commas.




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers