Assigning an array to a pointer in C

Viewed 109

I have just started learning C from David Griffiths Head first C book and I am confused in the section on pointers.

The problem :

This makes sense

char msg[] = "hello";

This also makes sense

char *ptr_of_msg = msg;

because array variables are similar to pointers

But how does this work ? :

char *ptr = "hello";

The thing on the right side is an actual array, how can it be assigned to a pointer ?

0 Answers
Related