These both statements are wrong
char[] name = { "Nitish prajapati" };
char* namePointer = &name ;
In C++ valid declaration of an array looks like
char name[] = { "Nitish prajapati" };
As for the second statement then there is no implicit conversion from type char ( * )[17]
to char *
.
The initializer of the declaration has type char ( * )[17]
while declared pointer has type char *
You should write either
char* namePointer = name ;
or
char ( *namePointer)[17] = &name ;
solved C++ char getting errors? [closed]