Thuta Learning
BasicProgrammingbeginner

Comments

Relax. We'll talk through this in plain words — no textbook voice.

Comments are notes you leave for anyone reading the code. The compiler doesn't run them. They're great for flagging important logic, formulas, or warnings — but you don't need to comment every single line.

c
#include <stdio.h>

int main() {
  // Print a welcome message
  printf("Welcome to C!
");

  /* This block can be used
     for longer notes. */
  printf("Comments make code easier to read.");
  return 0;
}

// is a single-line comment, and /* ... */ is a multi-line comment. Comments never show up in the program's output.

You should see
Welcome to C! Comments make code easier to read.

Info

A good comment explains the "why" behind the code. If the code is already obvious, skip the comment that just restates it — that keeps things cleaner.

Easy traps

  • If you forget to close a multi-line comment with */, the code that follows can accidentally get swallowed into the comment too.
Comments | Thuta Learning