C strings char* b = "hello"; int main() { for (int i=0; i<6; i++) { printf("char[%d] = '%c' (%d)\n", i, b[i], (int)b[i]); } return 0; } --- C arrays int a[3] = {1, 2, 3}; // an array of 3 int's char b[3] = {'a', 'b', 'c'}; // an array of 3 char's int main() { printf("%d\n", a[0]); a[1] += 1; // use index access *(a+2) = 5; // pointer access printf("%d %d\n", a[1], a[2]); // pointers to array elements printf("a %p a1 %p a2 %p a2 %p\n", a, a+1, a+2, &a[2]); // pointer arithmetic uses type printf("%p %p\n", b, b+1); return 0; } --- struct struct student { int id; char *name; }; int main() { struct student t; t.id = 1024; t.name = "alice"; struct student *p = &t; p->id += 1; printf("t.id =%d, t.name =%s\n", t.id, t.name); printf("p->id=%d, p->name=%s\n", p->id, p->name); } --- factor out typedef struct { int id; char *name; } student; student *new_student() { student a = {1, "bob"}; return &a; } int main() { student *p = new_student(); printf("p->id=%d, p->name=%s\n", p->id, p->name); } --- exploit warning void foo() { char *a = "this is just some random string"; //student a = {99999999, "RANDOM STUDENT"}; } --- malloc student *new_student() { student *a = (student*)malloc(sizeof(student)); a->id = 1; a->name = "bob"; return a; } --- check memory leak valgrind --leak-check=full ./your_program --- main function int main(int argc, char *argv[]) { for (int i=0; i