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 is meant by the "equivalence of pointers and arrays" in C?
write a programme to enter some number and find which number is maximum and which number is minimum from enterd numbers.
What is the explanation for the dangling pointer in c?
print the table 5 in loops
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
int a=0,b=2; if (a=0) b=0; else b=*10; What is the value of b ?
How can I increase the allowable number of simultaneously open files?
implement NAND gate logic in C code without using any bitwise operatior.
44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?
Write a program to find given number is even or odd without using any control statement.
How can I call a function with an argument list built up at run time?