You are not assigning an integer. You are assigning a pointer value determined by pointer arithmetic. In your statement, buf is behaving as a pointer (as dictated by the standard); you are adding 1 to it, then adding 5 to it.

say for instance to assign an array element to a character i would do
c = array[n];
here i is an integer
In the above problem by (array+1)[5] doesn't it mean array + 1 is a pointer to next element pointed by pointer array let it be arraynext
so arraynext[5] would mean *(arraynext + 5) which is a character and how is it assigned to a pointer.

As u said if it is a pointer why is it printing 9 instead of the address of the corresponding element

hi karri,
I am not sure , but i think buf refers to first element , (buf + 1) refers to second element and [5] means shift to 5 elements ahead. Then it will go to 7th element.
If you have gcc or cl you can create assembly code and see how its working.
For creating assembly code type gcc -S filename.c or for cl type cl /Fa filename.c

That's a lot of nonsense for nothing. buf+1 [5] results in pointer arithmetic being performed, therefore it means buf [6]. buf [6] is a character. p is a pointer. Assigning buf [6] to p should result in an error. If your compiler does not give you an error, either turn on all errors and warnings or, if they are on, get a decent compiler.

Warnings are almost always errors. The difference is that the compiler will be allowed to produce some code that does something. It MIGHT actually even do something precisely as you expect.

In those areas that the standard defines as "undefined behavior" or "implementation defined behavior" the compiler writer is not constrained. He may produce an ouput that performs exactly as you would like. On the next version he may produce output that burns your house down. Either is acceptable.

Correctness is not defined by the conformance of a compiler to your expectations. Correctness is defined by the standard and the compliance of a compiler is judged by that standard.

A judgement of 100% success, even if true today, is flawed if the behavior is undefined or implementation defined.

What am I saying? I am saying turn on all warnings and errors and heed them. I am saying write code correctly. Do not accept incorrect code, even if it "works" for you. It will return and bite you squarely in the *** one day.