Question: why do we need self referential object in javascript.
example 

```
let a = {};
a.self = a;

```

now a property self is referring to itself and become circular object.

in nodejs when we use routing library like hapi.
the request object which we receive is circular

Answer: 
The problem came from ***malloc(total\_courses + sizeof(course\_collection))***

You only allocate array of pointer of course\_collection.
You need allocate memory for whole the *struct Course*

It should be **malloc(total\_courses \* sizeof(struct Course))**
User this malloc(total\_courses + sizeof(struct Course)) instead of malloc(total\_courses + sizeof(course\_collection))

segmentation fault due to memory allocation mostly for arrays
arr[n] we use it till '0' to 'n-1' { carefully observe not 'n'}