I was hoping someone could help me figure out why one version of the below code works, while the other doesn't. Below I've included the **initArray** method, stored in "worksheet.c". The function is accessed in main, both versions are given below. 

```
void initArray(struct dynArray *a) {
    a->data = malloc(10 * TYPE_SIZE);
    assert(a->data != 0);
    a->size = 0;
    a->capacity = 10;   
}

```

This works. I create a dynArray struct and pass it to initArray by reference. 

```
#include "worksheet0.h"
#include <stdio.h>

int main(void)
{
    struct dynArray b;
    initArray(&b);
    return 0;
}

```

This fails with a seg fault. I thought that passing `b` here would be the same as passing the struct by reference. 

```
int main(void)
{
    struct dynArray *b = NULL;
    initArray(b);
    return 0;
}

```