1. Multi-dimentional arrays int matrix[3][2] = { {1, 2}, {3,4}, {5,6}}; int *p = &matrix[0][0]; for (i = 0; i < 3; i ++) { for (j = 0; j < 2; j++) { sum += matrix[i][j]; } } for (i = 0; i < 3 * 2; i++) { sum += p[i]; or sum += *(p+i); } 2. 2D array vs. array of pointers int m[3][2]; int *n[3]; m:|_|_|_|_|_|_|_| n: |_|_|_| char *names1[3] = {"alice","bob","clark"}; char names2[3][10] = {"alice","bob","clark"}; names1[3][1] type and value? names2[3][1] type and value? 3. structure struct student { int id; char *name; } struct student s; struct student *sp; s.id = 1; s.name = "alice"; sp = &s; sp->id = 3; printf("id %d, name %s\n", s.id, s.name); To make things simpler, typedef struct { int id; char *name; } student; student s; student *sp; sp = &s; //pointer to a struct sp->id = 0; sp->name = NULL; 4. A linked list #include typedef struct { int key; char *value; struct node *next; } node; node *head = NULL; void push(node *n) { n->next = head; head = n; } node * pop() { node *n = head; if (n) { head = n->next; } } void main() { node n1,n2; n1.key = 1; n1.value = "hello"; n2.key = 2; n2.value = "world"; push(&n1); push(&n2); } 5. malloc Global variables are allocated space before program execution. Local variables are allocated space at the entrace of a function/block and deallocated space upon exit. Allocate space dynamically on the heap (and have it persist across functions/blocks)? #include node * newNode(int key, char *value) { node *n = (node *)malloc(sizeof(node)); n->key = key; n->value = (char *)malloc(5000); return n; } void push(node *n) { n->number = x; n->next = head; head = n; } void main() { for (int i = 0; i < 1000000; i++) { n = newNode(i, "hello"); push(n); n = pop(); free(n); } }