Re: Is this valid initialize of char []
Thanks, but I tried to init den as following, and I changed the arguments type of const_str1 & const_str2 to const char*
const char* dent[] = {const_str1, const_str2};
the compiler reports (sorry not to give the compiler type, it is cc in HP Unix server):
cc: error 1521: Incorrect initialization.
Re: Is this valid initialize of char []
Quote:
Originally Posted by sandodo
Code:
char const_str[] = "a test";
char* dent[] = {const_str};
The problem is that const_str1, const_str2 are passed into the function as char* type arguments.
That's not a problem. A function with formal parameter of type pointer can always take a compatibly typed array as an actual parameter.