C Programming - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

C Syntax

C Syntax

shape Description

A program is nothing but a set of instructions which means words and symbols. These instructions are following certain rules called as Syntax Rules. C Syntax rules specify the sequence of characters, vocabulary and grammar in the program. In C-Language, characters are divided into the following categories:

C Syntax Rules


shape Description

C-tokens are the basic building blocks and smallest individual unit in writing a C-program. Tokens come together to form a program. They are divided into 6 types.

shape Token Types

shape Example

[c] #include<stdio.h> int main() { int x, y, total; x=1, y=2; total =x+y; printf(“total=%d",total); } [/c]


shape Description

Keywords are those words whose meaning is already defined by Compiler i.e. include, int, main.
  • Keywords are pre-defined words in C-Language.
  • Keywords and variable names are not same, as keywords are already reserved in the compiler.
  • Every keyword has its own meaning and cannot be edited by the programmer.
There are 32 keywords in C-language.

shape Keywords

auto break long return double else
enum union int register switch do
short case continue if const typedef
for static float default volatile char
short goto auto sizeof extern unsigned
signed void while


shape Description

Identifiers refers to the names of variable, types, functions, labels and arrays. Unlike Keywords, Identifiers are user-defined and can be changed as per the requirement.
  • First character of the identifier should be an alphabet(A-Z or a-z) or underscore( _ )
  • First character should never be a digit or any other symbol except underscore.
  • Identifiers are also case-sensitive.


shape Key Points

C syntax chapter draws out following main points.
  • C-language is case sensitive.
  • 32 Keywords in C-language which are pre-defined.
  • Identifiers are user-defined.

shape Programming Tips

Never use keyword as a variable name or function name as they are inbuilt in the system.