union
{
char ch[10];
short s;
}test;
test.s = 0xabcd;
main()
{
printf("%d",ch[10]);
}
Answers were Sorted based on User's Feedback
The code written is incorrect......
union
{
char ch[10];
short s;
}test;
test.s = 0xabcd;
main()
{
printf("%d",ch[10]);/*%D CAN'T BE USED FOR CHARACTER
EXTRACTION*/
}
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / vipul
the program is incorrect bcz in main function %d is used for integer type value and union is same as the structure and there is no return type in the main function thus it will return a charter type value,
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / maruthi
Answer:it will print the value of test.s because union
allocates memory for the largest sized variable.And 'll get
the value of recently stored variable.
| Is This Answer Correct ? | 0 Yes | 1 No |
What was noalias and what ever happened to it?
Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV
write a program to display all prime numbers
What is c method?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
What is period operator in c?
Difference between pass by reference and pass by value?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
What will be the output of following program #include main() { int x,y = 10; x = y * NULL; printf("%d",x); }
why wipro wase
what is an array
How variables are declared in c?