I wrote a C program as follows:

CASE 1
------

```
int *a; /* pointer variable declaration */

int b; /* actual variable declaration */

*a=11;

a=&b;/* store address of b in pointer variable*/

```

It gives a segmentation fault when running the program.

I changed the code as follows:

CASE 2
------

```
int *a; /* pointer variable declaration */

int b; /* actual variable declaration */

a=&b;/* store address of b in pointer variable*/

*a=11;

```

Now it's working fine.

If anyone knows please explain why it is giving a segmentation fault in CASE 1.