-
you are wrong about
scanf("%s",&customer_name);
it has problems itself even with the single word names - & should be lost
the fix for reading till the end of line instead of till the first whitespace is easy:
scanf("%29[^\n]",customer_name);
I have added the 29 - width specifier to avoid buffer overrun on very long names
in this case you will need to skip the rest of the line for next read to succed
-
Do u mean like this?
It skips the name ?
Code:
printf("\nEnter customer name : ");
scanf("%29[^\n]",customer_name);
printf("\nEnter weight [KG] : ");
scanf("%f",&weight);
-
try this
scanf(" %29[^\n]",customer_name);
to skip \n char left by the previous scanf
-
Thanks Vart!
now its all ok!