WeCodeAcademy

C Syntax and Comments

Each statement ends with a semicolon. Blocks use curly braces. C is case-sensitive. Comments are ignored by the compiler.

ExampleC
#include <stdio.h>

int main(void) {
  // single-line comment
  printf("One\n");
  /* multi-line
     comment */
  printf("Two\n");
  printf("Three ");
  printf("on one line\n");
  return 0;
}
Output
One
Two
Three on one line
Quick check

How do you write a single-line comment in C?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.