Question
#include<stdio.h>
struct my_struct
{
int i=7;
float f=999.99;
}var;
void main()
{
var.i=5;
printf("%d %.2f",var.i,var.f);
}
What will be output if you compile following c code ?
#include<stdio.h>
struct my_struct
{
int i=7;
float f=999.99;
}var;
void main()
{
var.i=5;
printf("%d %.2f",var.i,var.f);
}
Answer: Option A
Was this answer helpful ?
C language does not permit the initialization of individual structure members within the template. The initialization must be done only in the declaration of the actual variables.
Was this answer helpful ?
Submit Solution