Struct(s)
{
int a;
long b;
}
Union (u)
{int a;
long b;
}
Print sizeof(s)and sizeof(u) if sizeof(int)=4 and
sizeof(long)=4

Answers were Sorted based on User's Feedback



Struct(s) { int a; long b; } Union (u) {int a; long b; ..

Answer / jack

I assume above code to be correctly written as below:
struct s
{
int a;
long b;
}
Union u
{int a;
long b;
}
sizeof(s)= 8
sizeof(u) = 4

Is This Answer Correct ?    9 Yes 0 No

Struct(s) { int a; long b; } Union (u) {int a; long b; ..

Answer / vikraman85

Size fo strucure wil be the total bytes of the datatypes
inside it..
so,4+4=8;
For unions the size wi be the size of the datatype whose
memory is high,.
so,its 4,.

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More C Interview Questions

what will be the output off the following program? #include<stdio.h> int main() { int a; a=015+0*71+5; printf("%d,a"); return0; }

9 Answers   HCL,


who is the editor of 'pokemon'?

1 Answers  


Explain the use of fflush() function?

0 Answers  


Explain what is meant by 'bit masking'?

0 Answers  


What is the difference between union and anonymous union?

0 Answers   Hexaware,


What is the difference between void main() and void main (void) give example programme?

0 Answers  


How many parameters should a function have?

0 Answers  


How many keywords are there in c?

0 Answers  


how to find binary of number?

2 Answers  


i need all types of question paper releted to "c" and other language.

0 Answers  


Why do we need arrays in c?

0 Answers  


char ch="{'H','I',0};printf("%s",ch);what is output

9 Answers   Accenture,


Categories