Hi,
I am trying to get a sizeable multi dimension array using char **
ie
main()
{
char **data;
data[0]=new char[6];
strcpy(data[0],"Hello"
;
data[1]=new char[6];
strcpy(data[1],"World"
;
int x;
while(data[x] !=NULL)
{
printf("%s\n",data[x]); x++;
}
}
This causes a segmentation fault. What an i doing wrong?
I am trying to get a sizeable multi dimension array using char **
ie
main()
{
char **data;
data[0]=new char[6];
strcpy(data[0],"Hello"
data[1]=new char[6];
strcpy(data[1],"World"
int x;
while(data[x] !=NULL)
{
printf("%s\n",data[x]); x++;
}
}
This causes a segmentation fault. What an i doing wrong?