UP | HOME

HW35
COP-3223H

Submit via webcourses.

Using only your mind and/or pencil and paper (do not compile and run the program) What is the output of the following program? If an output is an address rather than a known integer, just put ADDRESS (%p is the format specifier for printing a pointer).

int *x;
int y;
int z;

y = 3;
x = &y;
z = *x;
*x = 10;
printf("z is %d\n", z);
printf("y is %d\n", y);
printf("x is %p\n", x);

x = &z;
z = 2;
y = 4;
printf("z is %d\n", z);
printf("y is %d\n", y);
printf("*x is %d\n", *x);

Author: Paul Gazzillo

Created: 2026-04-15 Wed 09:11

Validate