char stripper(char x[]){ char stripped[20]; int c=0; for(int i=0; i<strlen(x);i++){ if(x[i]==' '){ continue; } else{ stripped[c]=x[i]; c++; } } return stripped; } this is the function i've created to return a string/sentence without whitespaces. using this function as a void function and simply printing the stripped string works, but this iteration of the code returns (null). i am somewhat of a newbie to C so simple solutions to solve this problem would be appreciated. Thanks!
char* stripper(char x[])? You've defined the function to return achar. Also, stackoverflow.com/q/122616/2970947strlenon each end every iteration of the loop (unless you want it to run vastly slower). Take the length once, before entering the loop. It's just common sense.