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

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

Post by little joey »

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

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

Post by Martin Macko »

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 »

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)”