Simple c program for printing string

What does the following fragment of C program print?


answer is 12



The operations are done on p ,so how come q in this question got modified?Please explain

Shraddha @shraddhagami
30 Jan 2017 05:21 pm

answer is madebest

Ajith Supramani @ajithsupramani
30 Jan 2017 05:43 pm

yes, answer is madebest 

Ajith Supramani @ajithsupramani
30 Jan 2017 05:58 pm

Let's suppose the starting address of the array is 100.Then ∗p=q+4 means p stores the address 104.

Now strcpy() function writes from address 104 with string best and it ending with empty string in address 108.

Final array : madebest/0016  ( prints string q till it sees NULL character.)