Q:

Copy string to pointer to pointer

I am using this example:
char *myData[][2] =
{{"John", "j@usa.net"},
 {"Erik", "erik@usa.net"},
 {"Peter","peter@algonet.se"},
 {"Rikard","rikard@algonet.se"},
 {"Anders","anders@algonet.se"}};   

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];

A:

The pointers in myData[][] as you have it initialized point to literal strings.  That memory cannot be written to.
You can allocate new memory for your new strings and place the pointers to the new strings into myData.  Or for what you seem to be doing, just store the pointers to the argv[] strings (as long as you're not planning to modify the strings later).
Also, please make sure that the memory block you're copying strings into is large enough to hold the new string.
Software Monkey Edit: Including the \0 terminator; and make sure you free the memory when appropriate.

