C Syntax Rules:

  • Every C statement ends with a semicolon (;).
  • The main () function is the starting point.
  • Curly braces {} are used to define code blocks.
  • Comments:
    • Single line: // This is a comment
    • Multi-line: /* This is a multi-line comment */
  • Tokens in C :
  • Tokens are building blocks of a program.

Token Type

Example

Description

Keywords

int, float, if

Reserved words with special meaning

Identifiers

total, main

Names for variables, functions, etc.

Constants

5, ‘A’, 3.14

Fixed values

Strings

“Hello”

Sequence of characters

Operators

+, -, ==

Perform operations

Separators

;, ,, {}, ()

Structure the code