Your program includes the following declarations: union Code char c; short n; fl
ID: 3793120 • Letter: Y
Question
Your program includes the following declarations: union Code char c; short n; float f; Code Assuming that a char requires 1 byte, a short requires 4 bytes, and a float requires 8 bytes, how much memory will the partCode variable require? 1 4 8 13 Which operator can you use to retrieve the address of a variable? & * rightarrow ! Select equivalent statements to print value of x from below options. void main () int x float y; void main () struct def my Strucrt struct def *p = &my; Struct my Struct X =25; Struct my Struct = 1.23; printf("%d ", myStruct x); printf("%d ", p rightarrow x) printf("%d ", p rightarrow x) printf("%d ", *p)Explanation / Answer
Questoin 10:
The size of the union is the size of its biggest member.
Answer is c: 8
Question 11
& is used to retrive address of variable
Answer is a:&
Question 12:
Answer is A: printf("%d ",myStruct.x);
Sample code to test:
#include <stdio.h>
struct def{
int x;
float y;
};
int main()
{
struct def myStruct;
struct def *p = &myStruct;
myStruct.x = 25;
myStruct.y = 1.23;
printf("%d ",myStruct.x);
return 0;
}
Output:
25
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.