C Programing Unit 1
C Programing Unit 1
Programming
History of c programming
Language year Developed By
ALGOL 1960 International Group
BPCL 1967 Martin Richards
B 1970 Ken Thompson
Traditional C 1972 Dennis Ritchie
K&RC 1978 Kernighan & Dennis
Ritchie
ANSI C 1989 ANSI Committee
ANSI/ISO C 1990 ISO Committee
C99 1999 Standardization
Committee
Features of C Language
There are many features of c language are given below.
• Lines 1 and 2
• /* Fig. 2.1: fig02_01.c
A first program in C */
• begin with /* and end with */ indicating that these two
lines are a comment.
• You insert comments to document programs and
improve program readability.
• Comments do not cause the computer to perform any
action when the program is run.
A Simple C Program: Printing a Line of Text (Cont.)
variable = expression;
Example Program
Output
Example Program
Output
PREPROCESSOR DIRECTIVES
•Before a C program is compiled in a compiler, source code is processed by a
program called pre-processor. This process is called pre-processing.
•Commands used in pre-processor are called pre-processor directives and they
begin with “#” symbol.
Preprocessor Syntax/Description
Syntax: #define
Macro This macro defines constant value and can be any of the
basic data types.
Syntax: #include <filename>
Header file inclusion The source code of the file “filename” is included in the
main program at the specified place.
Syntax: #ifdef, #endif, #if, #else, #ifndef
Conditional Set of commands are included or excluded in source
compilation program before compilation with respect to the
condition.
Syntax: #undef, #pragma
#undef is used to undefine a defined macro variable.
Other directives
#Pragma is used to call a function before and after main
function in a C program.
A program in C language involves into different processes. Below diagram will help
you to understand all the processes that a C program comes across.