union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
}st;
int i;
}u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
A) 40, 4, 0
B) 100, 4, 0
C) 0, 0, 0
D) 4, 4, 0
?? endian ?
union u
{
union u
{
int i;
int j;
}a[10];
int b[10];
}u;
main()
{
printf("n%d", sizeof(u));
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
A) None of the Above
B) 1, 100, 1
C) 40, 4, 4
D) 4, 4, 4
Explanation: 20, 200, error for 3rd printf
main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; // Address of i is assigned to pointer p
printf("%f", i/(*p) ); // i is divided by pointer p
}
A) Compile error
B) 1.00000
C) Runtime error.
D) 0.00000
Explanation: Error because i/(*p) is 25/25 i.e 1 which is int & printed as a float, so abnormal program termination, runs if (float) i/(*p) -----> Type Casting.
-------compiler dependent.
Monday, August 17, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment