Question: I have done type casting with `int` and `char` but not with pointers so I posted this question.

```
#include <stdio.h>
int main() {
    int a[4] = { 1, 2, 6, 4 };
    char *p;
    p = (char *)a;   // what does this statement mean?
    printf("%d\n",*p);
    p = p + 1;        
    printf("%d",*p);  // after incrementing it gives 0 why?
}

```

The first call to `printf` gives the first element of the array. And after `p=p+1` it gives `0`. Why?

Answer: 
```
int a[4] = { 1, 2, 6, 4 };

```

declares a as array. `a` at this point of time stores the address of the first element of the array.

```
char *p;

```

declares p as a `pointer` to `character`

```
p = (char *)a;

```

Now since `p` & `a` both stores addresses. So the address stored at `a` (`address` of first element of the array) is assigned to `p`. The typecasting is done as `p` was declared as `char *`

what it does is that, assuming address stored at `a` is say 100 *and assuming that `int` takes 2 bytes and `char` takes 1 bytes in memory*

```
a+1 would return a+size of int(2) = 102

```

and 

```
p+1 would return p+size of char(1) = 101 

```

and that will explain the output as 

A. two bytes stored at `a` contains the first element of the array.

B. one byte stored at `p` is the character representation of the first byte of integer `1`, which is `0`.

Hope this helps.
If you use an intel like processor the bytes on the stack are stored using the little endian format. In more, probably the type int (on your computer) has size 4 bytes while char is 1 byte long (you can verify this using the c operator 'sizeof'), so the first element of your integer array is:

```
0x04 0x00 0x00 0x00

```

For this reason when you use a char pointer to see the values of your integer array, you proceed forward one bytes at time (not 4) with the obvious result you've obtained.

I hope this helps!