Question: > 
> **Possible Duplicate:**  
> 
> [Array of zero length](https://stackoverflow.com/questions/295027/array-of-zero-length) 
> 
> 
> 

I have seen such type of code :-

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

struct pkt {
  int pk_type;
  int tag;
  int magic_num;
  char data[0];  <-------- what does this mean ???
}__attribute__((packed));

typedef struct pkt p_t;
int main(void)
{
  p_t *p = (p_t *)calloc(1, sizeof(p_t));
  if(!p) {
    perror("p");
    return -1;
  }
  p->pk_type = 1;
  p->tag = 0xb00bbabe;
  p->magic_num = 0xcafebabe;
  strcpy("hello world", p->data); <-- Seg faults here !!!  

  return 0;

}

```

I was wondering the meaning of arr[0]. I mean in what scenarios do we need to use arr[0]. What purpose does it serve?

Answer: 
It's a [flexible array member](http://www.delorie.com/gnu/docs/gcc/gcc_42.html "flexible array member"), that can be used, when you need a structure of varying size. It simplifies the allocation of the extra size, just see the link.
char arr[0] is a same as char \*. And the reason you are getting segmentation fault is,because when you do calloc in following line of code 

```
p_t *p = (p_t *)calloc(1, sizeof(p_t));

```

it actually initialize every memory with zero.So when you passed a null pointer,it caused segmentation fault because of null pointer.