10897 - Travelling Distance

All about problems in Volume 108. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

User avatar
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey » Thu Sep 01, 2005 11:26 am

Your scanf() reads a string into a char variable. You can run into all kinds of trouble this way.

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko » Thu Sep 01, 2005 3:18 pm

little joey wrote:Your scanf() reads a string into a char variable. You can run into all kinds of trouble this way.
Yea, that's right... he should use " %c" instead of "%s". (not forgetting the space before %c to skip whitespaces.)

w k
Learning poster
Posts: 74
Joined: Wed Apr 14, 2004 11:14 pm

Post by w k » Thu Sep 01, 2005 8:25 pm

You're right!

I changed "%s" to " %c" and got AC!

Thanks little joey and Martin :wink:

Wojciech[/quote]

Post Reply

Return to “Volume 108 (10800-10899)”