You have defined
strArray
as an array of
char*
(i.e. pointers to character strings) but your allocation is of N * the size of a single character. I suspect what you meant was
char ** strArray = (char **)malloc(N * sizeof(char*));
Then you could use an assignment such as
strArray[1] = str;