Ask Question
5 January, 10:46

Consider the following program where the zu format specifier is used to display as an integer the result of sizeof. #include #include typedef union { int * i1; int * i2; }U; int main () { U temp; int i = 50; temp. i1 = &i; printf ("%zu and %d/n", sizeof (temp), * (temp. i2)); return 0; } What is the output of the program above? Note in the choices below indicates output that isn't any of the literal values in the code above.

+3
Answers (1)
  1. 5 January, 10:51
    0
    4 and 50

    Explanation:

    To answer the question above, we are to first of all consider the size of union will be the max size of datatype in union data. I. E.

    sizeof (int * ) is 4 bytes

    so, sizeof (U) = sizeof (temp) is 4

    and we saved 50 in temp. i1. so, 50 we can access 50 from temp. i2 as well

    so, output is 4 and 50
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Consider the following program where the zu format specifier is used to display as an integer the result of sizeof. #include #include ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers