Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Problem solved, thank you. I don´t know how to delete this post so...

What I have tried:

Thank you for helping, I do not know how to delete this post.
Posted
Updated 13-Apr-18 23:34pm
v5
Comments
Rick York 13-Apr-18 18:14pm    
This forum is here to answer questions about code. It is not here for people to debug your code for you. You need to do that so this would be a great time for you to learn how the debugger works because that is the best tool for this job.

1 solution

Your scanf statement is wrong. Array names are already pointers so do not need the addressof (&) operator:
C++
// wrong
while (scanf("%s %s", &op, &buf) == 2)
// should be just:
while (scanf("%s %s", op, buf) == 2)

You also need to flush the input for the next scanf, as there will still be a newline character to be read.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900