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
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 |
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 |
What is the use of a static variable in c?
Difference between exit() and _exit() function?
How will you divide two numbers in a MACRO?
plz answer..... a program that reads non-negative integer and computes and prints its factorial
C program to perform stack operation using singly linked list
What is the purpose of realloc()?
How are structure passing and returning implemented?
write a string copy function routine?
How can I set an array's size at run time?
Here is a neat trick for checking whether two strings are equal
Explain how do you determine a file’s attributes?
What is the purpose of & in scanf?