hi,
im doing an assignment and im only allowed to use scanf, otherwise i would use fgets etc
is there a way i can stop scanf from consuming whitespace?
thanks
Printable View
hi,
im doing an assignment and im only allowed to use scanf, otherwise i would use fgets etc
is there a way i can stop scanf from consuming whitespace?
thanks
Depends on what format you're using. Any numeric format (%d, %f) will consume whitespace while looking for a number, no matter what. %s will skip whitespace at the start. %c won't.
fair enough, their in %d.
hmmm maybe if i use %c and convert back to numbers