you can't do one of the following even , if you thinks that way.
That's the difference
char ** chararrayarray =
{
"My first string " ,
"My Second string " ,
"My third string",
"My fourth string "
};
the meaning of this is pointer to pointer to a char , but it can continue until it found the zero character. so this is wrong then.
or
char [][] chararrayarray =
{
"My first string " ,
"My Second string " ,
"My third string",
"My fourth string "
};
the meaning of this is array of ( char array)
but
char *chararrayarray[] =
{
"My first string " ,
"My Second string " ,
"My third string",
"My fourth string "
};
is correct ! That's the difference. The meaning of this is array of (char *) , so you can openly do this.
but you can do this.
char * chararrayarray1[] =
{
"My first string " ,
"My Second string " ,
"My third string",
"My fourth string "
};
char ** chararrayarray =chararrayarray1 ;
and try this program .
#include <iostream>
using namespace std ;
char * chararrayarray1[] =
{
"My first string " ,
"My Second string " ,
"My third string",
"My fourth string "
};
char ** chararrayarray = chararrayarray1 ;
int main(int argc, char* argv[])
{
cout << *(chararrayarray) <<endl ;
cout << *(chararrayarray+1) << endl ;
cout << *(chararrayarray+2) << endl;
return 0;
}