please explain the type : char*

char a[3] = "que";

Here array name (a), represents the address of first array element.
So array name is of type char*.

please explain the type : char*


Last edited on
char a[3] = "que";

Here array name (a), represents the address of first array element.

The array name (a) may be used as the address of the first array element in certain circumstances. It is not, however, the address of the first array element.


So array name is of type char*.

array name is of a type we call an identifier. The variable named a has type char[3] (array of 3 char), not char* (pointer to char.)


This code will cause an error, by the way. The type of "que" (const char[4]) cannot be contained in a because a is too small.
http://www.cplusplus.com/doc/tutorial/pointers

Look at Pointers and string literals
Last edited on
thanks @cire @MiiNiPaa
Topic archived. No new replies allowed.