Join Dan Gookin for an in-depth discussion in this video Adding comments to the code, part of Learning C (2014).
- I'd like to add a comment to the source code.…This is text that doesn't compile.…Instead it's intended as a note for the programmer,…a reminder, or just general information.…Insert a new line at the top of your source code file.…Type /*.…Traditional C comments start with the /*…character combination, and end with the */ characters.…The editor highlights all the text in the code,…which is now effectively one long comment,…because no ending comment characters have been written.…
Type your name and the date.…Type */ to end the comment.…Comments aren't compiled, and you can prove it.…Save the changes, Build and Run, and the output is the same.…A second type of comment uses // at the start of a line.…You can use this comment to disable a statement in the code,…which happens a lot when you're hunting down bugs…or trying to fix something.…I'll comment out line six, the first PUT Statement.…
Save, Build and Run.…See how the output doesn't appear?…That's because the compiler treated it like a comment.…If you'd like to restore the line, remove the // comment,…
- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures
Skill Level Beginner
1. Getting Started
2. Programming Basics
3. Program Flow Control
4. Intermediate C Language Concepts
5. Advanced C Language Concepts
Next steps2m 11s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.