Are char ch[][]
and char *ch[]
both are same
No, they are not the same.
char ch[][]
is an array of indeterminate length of arrays of indeterminate length. Such array is ill-formed because array element may not be an array of indeterminate length.
char *ch[]
is an array of indeterminate length of pointers.
char ch[3][2] = {{'1','2'},{'3','4'},{'5','6'}};
cout<<ch[0]<<endl;
Here, you insert a pointer to a character (the array implicitly converts to pointer to first element) into a character stream. The character stream requires that such character array (i.e. string) must be null terminated. Your character array is not null terminated. As a consequence of violating the pre-condition, the behaviour of the program is undefined.
char *cha[3] = {"12","34","56"};
This on the other hand is ill-formed in C++11 and later, because you are initialising pointers to non-const with a const array (the string literal). To fix this, use an array of pointers to conts char instead.