There are no intentional syntax errors in this section.
main () { int i, j, *p, *q ; p = &i ; q = &j ; *p = 3 ; *q = *p + i ; printf("i = %d, j = %d\n", i, j) ; }
Click here for a sample solution.
void foobar (int A[]) { printf("A[0] = %d, A[1] = %d, A[2] = %d\n", A[0], A[1], A[2]) ; A[1] = 0 ; } main() { int A[3] = {1, 2, 3} ; foobar(A) ; printf("A[0] = %d, A[1] = %d, A[2] = %d\n", A[0], A[1], A[2]) ; }
Click here for a sample solution.
void add_5 (int a, int *p) { *p = a + 5; } main() { int x = 1, y = 3; add_5 (x, &x) ; printf("x = %d, y = %d\n", x, y) ; add_5 (x, &y) ; printf("x = %d, y = %d\n", x, y) ; }
Click here for a sample solution.