Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following code: int main () { int x[5]; x[0] = 3; x[1] = 2; x[2] = 1; x[3] = 0; char *y =
Consider the following code:
int main () { int x[5]; x[0] = 3; x[1] = 2; x[2] = 1; x[3] = 0; char *y = (char*) x; // we'll run some print statements here }
We'll assume the following:
-
the address of x's first element is 0x4000
-
sizeof(char) == 1; sizeof(int) == 4;
- this computer is big-endian
Fill in the blank with the printed value.
If the value printed is uncertain, enter "garbage". If this program would cause a compile-time error or the behavior is uncertain, enter "n/a".
Q2.5 1 Point e) printf ("%p", x+4); 68 X Incorrect Submit Last submitted on Feb 13 at 6:47 PM Q2.6 1 Point print f ("%p", &x); Enter your answer here Submit Q2.7 1 Point g) printf ( "%d", x[ 7 ] ) ; Enter your answer here Submit Q2.8 Point h) printf("%d", *y); Enter your answer here Submit Q2.9 1 Point printf ( " %d", * ( y+3 ) ) ; Enter your answer here Submit Q3 Pointers and Structs 6 Points Consider the following code: typedef struct Point int x; int yi Point void changex1 (Point pt) f 11; void changex2 (Point *pt) void changeX3 (Point *pt) void changeX4 (Point *pt) void changex5 (Point *pt) pt . x = pt.x22; pt-x 33 pt 55 int main) // main body our code goes here Fill in the blank with the printed value if we replace the "main body" with each of the following. If the value printed is uncertain, enter "garbage". If this program would cause a compile-time error or the behavior is uncertain, enter "n/a". Q3.1 Point Code: Point my_pt14, 2; changexl (my_pt) printf("%d ", my-pt.x); Enter your answer here Submit Q3.2 1 Point Code: Point my_pt; changeX1 (my _pt) printf ("%d ", my-pt.x); Enter your answer here Submit Q3.3 1 Point Code: Point my_pt changex2 (&my_pt) printf ("%d ", my_pt.x); Enter your answer hereStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started