Question: 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".

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'llassume 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

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 here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!