Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with scanf 1

Status
Not open for further replies.

mattias1975

Programmer
Jul 26, 2004
36
0
0
SE
Hello!

I have problem with the function scanf.
My program looks like this:

scanf("%s", a);
scanf("%s", b);

I run it and enter the value of a.
But after that it jumps over the other scanf so that i don't get the chance to enter the value b.

I know its possible to solve the problem so i can use scanf but i dont know how to do it. And thats my question.

I am not allowed to use any other functions because i am taking a c course and i have to know how scanf works.

Thank you.
 
1. Always use this forum markup tag CODE for your sources (see Process TGML link on the form).
2. What's your a (and b) var declarations?
3. Remember that scanf("%s"...) reads upto a 1st whitespace (not newline)
4. What's your true problem?..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top