I have this function that takes in a string and splits it into words, then store the words into a 2D array, but I am having trouble returning the 2d array. Error: return makes pointer from interger without cast.
char *split_message(char *message)
{
int indexCtr = 0;
int wordIndex = 0;
int totalWords = 0;
int i,rows=0;
int columns= strlen(message);
for(i=0; i<strlen(message);i++)
{
if(message[i]==' ');
{
rows++;
}
}
char sentence_split[rows][columns];
for(indexCtr=0;indexCtr<=strlen(message);indexCtr++)
{
if(message[indexCtr]==' '||message[indexCtr]=='\0')
{
sentence_split[totalWords][wordIndex]='\0';
totalWords++;
wordIndex=0;
}
else
{
sentence_split[totalWords][wordIndex] = message[indexCtr];
wordIndex++;
}
}
return sentence_split[rows][columns];
}