Sail E0 Webinar
Question

What will be output if you compile following c code ?


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


Options:
A .  Compile Error
B .  5 9.76723
C .  5 9.76
D .  5 9.77
Answer: Option D

Though both <struct type name> and <structure variables> are optional, one of the two
must appear. In the above program, <structure variable> i.e. var is used. (2 decimal places or)
2-digit precision of 9.76723 is 9.77



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers