1. Basics of “C” Programming
By
R.Sivagami, Assistant Professor
Department of Computer Science and Applications
D.K.M College for women(Autonomous), Vellore-1.
2. What is C Language
• C is mother language of all programming language.
• It is a popular computer programming language
• It is procedure-oriented programming language.
• It is also called mid level programming language
4. Cont…
• C is a programming language developed at AT & T’s Bell Laboratories of
USA in 1972. It was designed and written by a man named Dennis Ritchie
• ANSI C standard emerged in the early 1980s, this book was split into two
titles: The original was still called Programming in C, and the title that
covered ANSI C was called Programming in ANSI C. This was done
because it took several years for the compiler vendors to release their ANSI
C compilers and for them to become ubiquitous. It was initially designed for
programming UNIX operating system. Now the software tool as well as the
C compiler is written in C. Major parts of popular operating systems like
Windows, UNIX, Linux is still written in C. This is because even today
when it comes to performance (speed of execution) nothing beats C.
Moreover, if one is to extend the operating system to work with new devices
one needs to write device driver programs. These programs are exclusively
written in C. often heard today is – “C has been already super ceded by
languages like C++, C# and Java.
5. Features of C Language
There are many features of c languages are given below:
• Machine independent or Portable.
• Mid-level programming language
• Structured programming language
• General-purpose language
• Rich in library
• Procedural Language
• Fast and efficient
• Easy to extend
6. Terminologies of ‘C’
1. Keywords
2. Identifiers
3. Variables
4. Constants
5. Special Symbols
6. Operators
7. Character & String
7. 1.Keywords
• Keywords are the reserved words
• C has 32 Keywords.
• These Keywords combined with a formal syntax from C programming
language
• Rules to be followed for all programs written in c:
• All keywords are lower-cased
• C is case sensitive, do-while is different from DO-WHILE
• Keywords cannot be used as a variable or function name
8.
9. 2.Identifiers
• Identifiers refer to the name of variables, functions and arrays.
• These are user-defined names and consist of sequence of letters and
digits, with a letter as a first character.
• Both uppercase and lowercase letters permitted, although lowercase
letters are commonly used.
• The underscore character is also permitted in identifiers. It is usually
used as a link between two words in long identifiers.
10. Identifier names
• The number of characters in the variable that are recognized differs from
compiler to compiler
• An identifier cannot be the same as a C Keyword
11.
12. 3.Variables
Variables are named locations in memory that are used to hold a
value that may be modified by the program.
Unlike constants that remain unchanged during the execution of a
program.
A variable may take different values at different times during
execution.
The syntax for declaring a variable is –
Datatype Identifier Name;
Example - int sum;
Long int sum , a;
13.
14. 4.Constants
Constants are the fixed values that do not change during the
execution of a program.
C supports several types of constants.
Numeric Constants
Integer constants
Real constants
Character Constants
Single character constant
String constants
15.
16. 5. Special Symbols
• !,@,#,$,&,*,……. These all symbols that can be find
on Keyboard, are called Special Symbols.
• Every symbol has its special meaning in different
respect at different place that’s why it is called as
special symbols
17. 6.Operators
Operator is a symbol that operates on one or more
operands and produces output.
Example - c=a + b;
In the above Example the symbols + and + are
operators that operate on operands a , b, and c.
18.
19. 7. Character & String
The characters that can be used to form words, numbers and
expressions depend upon the computer on which the program is
running.
The character in C are grouped into the following categories:
1. Letters
2. Digits
3. Special characters
4. White Spaces
Remember that a character ‘a’ is not equivalent to the string “a”.