I made this function:
char** parse_cmd(const char* cmdline) {
int i;
int j = 0 ,k = 0;
char ch[100][100];
for(i=0; i<strlen(cmdline); i++) {
if(cmdline[i] != ' ') {
ch[j][k] = cmdline[i];
k++;
} else {
j++;
k = 0;
}
}
return ch;
}
But when I compile the program I have this warning:
shell.c: In function ‘parse_cmd’:
shell.c:25:2: warning: return from incompatible pointer type
shell.c:25:2: warning: function returns address of local variable
Why?