Draw a memory diagram, and predict the output. If something is unpredictable by just reading the code, say so. Have someone in your group share a Zoom whiteboard and draw a memory diagram that you all contribute to.

#include <stdio.h>
#include <stdlib.h>

struct Thing {
   int a;
   struct Thing *b;
};
typedef struct Thing Thing;

int main() {
   Thing x;
   Thing *y;
   Thing *z;
   x.a = 3;
   x.b = malloc(sizeof(Thing));
   y = malloc(sizeof(Thing));
   y->b = malloc(sizeof(Thing));
   z = 12;

   printf("%i\n",x.a);
   printf("%i\n",y);
   printf("%i\n",y->a);
   printf("%i\n",z);

   y->b = &x;
   z = malloc(sizeof(Thing));
   y->a = 9;
   z->b = y;
   z->a = 47;
   (y->b)->a = 7;

   printf("%i\n",x.a);
   printf("%i\n",y->a);
   printf("%i\n",(y->b)->a);
   printf("%i\n",z->a);
}