Can you explain how we got the answer of question?

Please explain .Nothing related to this has been explained in the video lectures?
The answer given is option C

hey @isingh
p is a character pointer.
p = sample_string;
through this statement, p will point to the 0th element of the string
p+=6
this statement, through pointer arithmetics will make p point at the 6th index of the string
so if you print p, the string will be printed from that index onwards.

p+=6 is the shortcut for wrinting p = p+6 . As p points to the first element of the array, if we add 6 to it will then point to the element with the index 6. In short, if we write p+=n , that means we are adding the value n to p and p will now be pointing to the element with index n .

As you told p will point to the 0th element of string. But what I don’t get is how is printing p, printing the whole string? Is it internal mechanism of a pointer? Can you explain?

When we print a character pointer it will print everything present before first Null char(\0)

Is this property applicable for pointers of other data types as well, like int?

Nope only for char pointers

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.