Declaring Strings In C

In C, how they are different?

char str[] = "xyz";         // statement 

//and 

char str[4] = "xyz";        // statement 

The first, in my understanding, assigns a pointer to a string literal, whereas the second is a four-character character array (including the NULL character).

So how are these two preserved in memory if this is the case?

1 Like