Sail E0 Webinar
Question

What will be output if you compile following c code ?


#include<stdio.h>
struct my_struct
{
int i;
unsigned int j;
};
void main()
{
struct my_struct temp1={-32769,-1},temp2;
temp2=temp1;
printf("%d %u",temp2.i,temp2.j);
}


Options:
A .  32767 -1
B .  -32769 -1
C .  -32769 65535
D .  32767 65535
Answer: Option D

An entire structure variable can be assigned to another structure variable, provided both variables have the same composition.



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers