Hello guys!
Here:
#include <stdio.h>
char* getStr( char *c ){
scanf( "%s" , c );
return c;
}
int main(){
char str[ 100 ];
getStr( str );
printf( "%s" , str );
return 0;
}
Could you please explain why is the string printed only until the first “space”.
i.e.
input: asd asd
output: asd
Because that’s what
scanfdoes. If you want to read a string till newline, usegetsEDIT: or its buffer-overflow-safe cousinfgets(thanks, @JayC)