From the course: Complete Guide to C Programming Foundations
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Solution: Find and fix the bugs - C Tutorial
From the course: Complete Guide to C Programming Foundations
Solution: Find and fix the bugs
- [Instructor] I am going to work through this challenge to show you how I arrived at the solution. First, if the editor is color coded as most are, and this one is here, you see what I call string bleed. This string starts here, but it's unterminated. The color coding in the editor assumes that all of this text is part of the string. So the first thing you can fix is to add the double quote right here at the end of the Print F statement before the parentheses. See how the colors change. Now, to find the second bug, I can go ahead and run the code and the compiler should tell me where it is. And there you go. Expected a semicolon before the brace and it says line 13. Let's go look at line 13. Yeah, you can see the squiggly underline. Here's the second bug it's a missing semicolon. This is very common lots of C programmers forget semicolons, even me. Add the semicolon and try to run again. Have the compiler help you here. Oh, well, it looks like something's working, there you go…
Contents
-
-
-
Coding your first program3m 40s
-
(Locked)
Challenge: Write your own code51s
-
(Locked)
Solution: Write your own code1m 50s
-
(Locked)
Getting into the C language2m 34s
-
(Locked)
Reviewing code structure3m 52s
-
(Locked)
Working the C development cycle3m 45s
-
(Locked)
Challenge: Find and fix the bugs43s
-
(Locked)
Solution: Find and fix the bugs1m 28s
-
(Locked)
Exploring the preprocessor3m 23s
-
(Locked)
Understanding header files and libraries3m 19s
-
(Locked)
Adding comments2m 49s
-
(Locked)
Chapter challenge: Building the foundation1m 11s
-
(Locked)
Chapter solution: Building the foundation1m 38s
-
-
-
-
-
-
-
-
-
-
-