I have a a problem copying individual words inside 2D array. Array is dynamically created and initializes perfectly, but as soon as i call my function, and if i have 2 or more spaces between the words, its copying the spaces inside the next index element of the array. Am I missing something? Any help is appreciated! Thank you

void strToArray(char** my2D_Container, char* my_String){
	int j = 0;
	int p = 0;
	for (int i = 0; my_String[i]; i++) {
		j = 0;
		while ((my_String[i] != 32 && my_String[i] != '\n') && my_String[i]) {
			my2D_Container[p][j++] = my_String[i++];
		my2D_Container[p][j] = '\0'; 

After the while loop that starts on line 8 of the code you posted you need to add another while loop that searches for the next non-space character so that the function skips all spaces between words.