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 |
application attempts to perform an operation?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
#include<stdio.h> main() { int a=1; int b=0; b=++a + ++a; printf("%d %d",a,b); }
Write a code to generate divisors of an integer?
implement general tree using link list
1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array?
how to print this sereis 2 4 3 6 5..........?
difference between string and array?
Explain enumerated types.
difference between c and c++?
1)what is the error in the following stmt where str is a char array and the stmt is supposed to traverse through the whole character string str? for(i=0;str[i];i++) a)There is no error. b)There shud be no ; after the stmt. c)The cond shud be str[i]!='\0' d)The cond shud be str[i]!=NULL e)i shud be initialized to 1
How can I implement sets or arrays of bits?