I am using this example:
char *myData[][2] =
{{"John", "[email protected]"},
{"Erik", "[email protected]"},
{"Peter","[email protected]"},
{"Rikard","[email protected]"},
{"Anders","[email protected]"}};
char **tableData[6];
tableData[0] = myData[0];
tableData[1] = myData[1];
tableData[2] = myData[2];
tableData[3] = myData[3];
tableData[4] = myData[4];
tableData[5] = NULL;//null terminated array
and instead want to place my own strings for name and emails. (trying to place string xyz into myData, then tableData) strcpy with myData wont work. I have tried all combination's of pointers and referencing but it doesn't seem to copy the string. Any suggestions?
ok--> strncpy(xyz, argv[i], strlen(argv[i]));
ok--> strcpy(xyz + strlen(argv[i]), "\0");
run time stops here--> strncpy(myData[i][0], xyz, strlen(xyz));
tableData[i] = myData[i];