Video 1 – Introduction to C Programming
One of the most popular computer languages
Structured high level languages
Developed by Dennis Ritchie in 1972
Efficient and fast coding language
Supported in all operating systems and hardwares
Lots of compilers are available
Character Set
The basic source character set for C language includes:
1. Letters:
a. Uppercase letters : A, B, C, …, Z
b. Lowercase letters : a, b, c, …, z
2. Digits: 0, 1, 2, …, 9
3. Special characters: , . : ; ! “ ^ & * ( ) { } [ ] < > |\ / _ ~ etc.
4. White space characters:
Token in C
Tokens are the smallest individual units in a program
It includes:
o Identifiers - user specified names
o Keywords – words with predefined meanings specific to C
o Constants – Fixed values like integer, character, float
o Strings – sequence of characters
o Other symbols
Identifiers and Keywords
Keywords have a specific meaning
It has a predefined purpose
Identifiers are names given to variables on our choice
Keywords MUST NOT be used as identifiers
Identifiers
An identifier refers to the name given to a variable or a function.
The rules to write an identifier name on C are:
o Identifier name in C can have letters, digits or underscores.
o The first character of an identifier name mist be a letter or an
underscore. The first character of an identifier name cannot
be a digit.
o No special character (except underscore), blank space and
comma can be used in an identifier name.
o Keywords or reserved words should not be used as identifier.
Keywords
Keyword is a reserved word that has a particular meaning in the
programming language
The meaning of a keyword is predefined
A keyword cannot be used as an identifier name in C language.
List of Keywords in C
S.N Keyword S.N Keyword S.N Keyword S.N Keyword
o. o. o. o.
1 auto 9 double 17 int 25 struct
2 break 10 else 18 long 26 switch
3 case 11 enum 19 register 27 typedef
4 char 12 extern 20 return 28 union
5 const 13 float 21 short 29 unsigned
6 continue 14 for 22 signed 30 void
7 default 15 goto 23 sizeof 31 volatile
8 do 16 if 24 static 32 while
Variable declaration and initialisation
Int age;
Comments
A single line comment starts with two forward slashes (i.e //) and is
automatically terminated with the end of line.
A multi-line comment starts with /* and terminates with */. A multi-line
comment is used when multiple lines of text are to be commented.
Comment lines are not executable statements and therefore anything
between /* and */ is ignored by the compiler.
Introduction to Programming
Each statement should end with a semicolon
Eg: int a;
a+b=c;
The execution begins at this line main(). The main( ) is a special
function used by the C system to tell the computer where the program
starts. Every program must have exactly one main function.