2. [i]
Copyright & Disclaimer
Copyright 2017 by www.besthinditutorials.com. All the content and graphics
published in this e-book are the property of www.besthinditutorials.com. The user of
this e-book is prohibited to reuse, retain, copy, distribute or republish any contents
or a part of contents of this e-book in any manner without written consent of the
publisher. We strive to update the contents of our website and tutorials as timely
and as precisely as possible, however, the contents may contain inaccuracies or
errors. www.besthinditutorials.com provides no guarantee regarding the accuracy,
timeliness or completeness of our website or its contents including this tutorial. If
you discover any errors on our website or in this tutorial, please notify us at
contact@besthinditutorials.com
https://www.facebook.com/besthinditutorials
https://twitter.com/BH_Tutorials
https://plus.google.com/+Besthinditutorialscom
3. [ii]
Table of Contents
.................................................................................................................................1What is Programming?
Introduction to Programming..............................................................................................................1
Programming Language............................................................................................................................1
Compiler / Interpreter.............................................................................................................................3
Programmer ......................................................................................................................................................3
...................................................................................................................................4Basics of C Language
Introduction to C language..................................................................................................................4
A simple program in C language.................................................................................................6
................................................................................................................................7C Compiler Installation
Introduction to Dev C++ Compiler ................................................................................................7
Installing Dev C++ compiler...............................................................................................................7
Working with Dev C++ compiler...................................................................................................12
....................................................................................................16C Tokens, Identifiers & Keywords
Introduction to C Tokens.....................................................................................................................16
C Character Set...........................................................................................................................................17
Identifiers.........................................................................................................................................................17
Keywords ..........................................................................................................................................................18
.....................................................................................................................................................19C Data Types
Introduction to C Data Types ..........................................................................................................19
Different C data types ...........................................................................................................................19
Void type..........................................................................................................................................................21
...........................................................................................................................22C Variables & Constants
Introduction to C variables ................................................................................................................22
Scope of variables.....................................................................................................................................24
Constants in C..............................................................................................................................................25
...................................................................................................................................................28C Flow Charts
Introduction to Flow Chart.................................................................................................................28
4. [iii]
Symbols of Flow Chart ..........................................................................................................................29
Example of Flow Chart..........................................................................................................................30
...............................................................................................................................................32First C program
C program development life cycle ................................................................................................32
Structure of A C program...................................................................................................................33
Your first C program...............................................................................................................................33
Commenting ....................................................................................................................................................34
.........................................................................................................................................................35C Operators
Introduction to C operators...............................................................................................................35
.........................................................................................................................................46C Decision Making
Introduction to C decision making...............................................................................................46
If statement...................................................................................................................................................47
If-Else statement........................................................................................................................................48
Switch statement........................................................................................................................................49
.............................................................................................................................................................52C Looping
Introduction to C language looping.............................................................................................52
C while loop ..................................................................................................................................................53
C Do-while loop ..........................................................................................................................................54
C For loop .......................................................................................................................................................55
................................................................................................................................................................56C Arrays
Introduction to C arrays ......................................................................................................................56
Creating c arrays........................................................................................................................................56
Initializing C arrays..................................................................................................................................57
Accessing array elements.....................................................................................................................58
Two Dimensional Arrays .......................................................................................................................59
...............................................................................................................................................................63C Strings
Introduction to C strings .....................................................................................................................63
gets() and puts() functions ...............................................................................................................64
5. [iv]
Other string functions ............................................................................................................................65
.........................................................................................................................................................66C Functions
Introduction to C functions................................................................................................................66
Predefined & user defined functions ..........................................................................................66
Advantages of functions........................................................................................................................67
Creating & using functions in C ....................................................................................................67
Example .............................................................................................................................................................70
.......................................................................................................................................................71C Structures
Introduction to C structures..............................................................................................................71
Defining a structure.................................................................................................................................71
Creating structure variables...............................................................................................................72
Accessing structure members ...........................................................................................................73
Example .............................................................................................................................................................73
...............................................................................................................................................................75C Unions
Introduction to C unions.................................................................................................................75
.........................................................................................................................................................78C Recursion
Introduction to C Recursion ..............................................................................................................78
Types of Recursion ...................................................................................................................................79
Example of Recursion (Factorial).......................................................................................................80
............................................................................................................................................................83C Pointers
Introduction to C pointers..................................................................................................................83
Working with pointers............................................................................................................................84
Example .............................................................................................................................................................85
..........................................................................................................................................87C Storage Classes
Introduction to C storage classes.................................................................................................87
................................................................................................................................................91C File Handling
Introduction to C file handling .......................................................................................................91
Opening a file...............................................................................................................................................91
6. [v]
Reading from a file..................................................................................................................................93
Writing to a file .........................................................................................................................................94
Closing a file.................................................................................................................................................94
.............................................................................................................................................95C Error Handling
Introduction to C error handling...................................................................................................95
exit() function...............................................................................................................................................97
..................................................................................................................................................98C Header Files
Introduction to C header files.........................................................................................................98
Types of header files..............................................................................................................................98
Working with header files...................................................................................................................99
....................................................................................................................101C Preprocessors Directives
Introduction to C preprocessor directives.............................................................................101