Directions: Fill in answers on the pages below. Don't spend too much time on any one problem. Even if you have forgotten some things, fake it as well as you can.
int main() { int a[4][3]; int i, j; for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) a[i][j] = i*10 + j; a[2][4] = 777; i = ; j = ; if (0 <= i && i < 4 && 0 <= j && j < 3 && a[2][4] == a[i][j]) printf("OK\n"); printf("a[2][4]: %i\n", a[2][4]); printf("a[%i][%i]: %i\n", i, j, a[i][j]); }
int main() { int **a = /* MISSING A */; int i, j; for (i = 0; i < 4; i++) { *(a + i) = /* MISSING B */; for (j = 0; j < 3; j++) /* MISSING C */ = i*10 + j; } /* MISSING D */ }
When you finish adding answers to the first four questions below, you should have a single, complete, and correct program.
struct person { char *name; int age; };
Answers to the remaining 5 questions should be combined with the above struct definition into a single, complete, and correct program.
2 * ( 1 + 3 * 4 + 5 ) $
#include <stdio.h> struct link { char c; struct link *next; }; int main() { struct link *list = NULL, *save; char ch; while ((ch = getchar()) != '\n') { save = list; list = (struct link *)malloc(sizeof(struct link)); list -> c = ch; list -> next = save; } printlist(list); printreverse(list); printf("\n"); }