This is not what i meanscanf("%s %s %s", str1, str2, str3);
An easy way is to use a different delimiter, say ;
scanf("%[^;];%[^;];%[^;];", str1, str2, str3);
see my uploaded image below
it is from source CODE here,
Code:#include<stdio.h> #include<stdlib.h> #define STR_MAX 100 main() {char x[STR_MAX]; printf("Your name =");scanf("%s",x); printf("Your name is =%4s\n",x);system("pause");return EXIT_SUCCESS;}



40Likes
LinkBack URL
About LinkBacks





