Modal Box

Syntax and Rules

There are certain rules for making a program in any programming language commonly known as the syntax of the langauge.

Syntax for C language program

  1. Every executable statement must end with semicolon symbol ” ; ” (except some, like control statements and function declarations.
  2. Every C program must contain exactly one main method (main function is the entry point for the program).
  3. All the system defined words (keywords) already defined in C language are in small case.
  4. Keywords can not be used as user defined names (identifiers).
  5. For every open brace ” { “, there must be respective closing brace ” } “.
  6. Every variable must be declared bofore it is used.

Rules for variable declaration in C Language

  1. Variable name is the combination of english alphabets , digits and underscore.
  2. No space is allowed in variable name.
  3. No special symbol is allowed except underscore ( _ ) .
  4. First character of a variable must be an english alphabet.
eg: char first_name, int price10 are valid variable names.
eg: char last name, int 5price are not valid names.

Video/ C Introduction

Watch video in full size