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 are integer variable, floating-point variable and character variable?
when to use : in c program?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
Why malloc is faster than calloc?
What is scope rule of function in c?
Please write the area of a RIGHT ANGLED TRIANGLE.
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
How can I find out if there are characters available for reading?
enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above
where do we use volatile keyword?
How many ways are there to swap two numbers without using temporary variable? Give the each logic.
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM