Debugging Syntax Error Problems
In this section, each of the programs shown below contain syntax errors. Although the programs are small and it is likely that you will find the errors quickly (possibly without compiling the code) it is to your benefit to see what error messages are produced should you make such an error as shown.
For each program below:
1) compile the program WITH the syntax error in place (copy and paste), write down the error message your compiler gives you. The reason to do this is because you need to learn what the error messages are saying to you. Writing it down will help you remember.
2) explain in your own words what the problem is.
3) Fix the error, recompile and match against the output provided. explain how you did it.
Problem 1
What your program will show if it was running properly:
What error message did you get when you compiled it?
What was wrong and how did you fix the above program?
Problem 2
What your program will show if it was running properly:
What error message did you get when you compiled it?
What was wrong and how did you fix the above program?
Problem 3
What error message did you get when you compiled it?
What was wrong and how did you fix the above program?
Last updated