C Programming HandWritten Notes : 500 INR
C++ Programming HandWritten Notes : 300 INR
Contact : 8602768216
Q. What is Header Files? Why do we use them?
Ans. In C/C++ any file which has the extension ".h" is called as a " Header File" and these header files are created
by the company which develops the software(IDE)(Integrated Development Environment) of C-Language.
Inside These Header Files , there are a small predefined programs called function.
For Example : On Mathematical Functions like
sqrt()
sin()
cos()
pow() etc are available in a header file called "math.h" . Similarly all the functions which can draw different
geometrical figures like
circle()
rectangle()
line()
ellipse()
bar()
arc() etc. are available in a header file called "graphics.h".
Now if programmer wants to write a program in C Language then he can simplify his task by using above mentioned
function . But For This he must attached the required header file into his program and to do this C Language gives
us a command called "#include".
===============================================================
Q. What is stdio.h and Why do we use it?
Ans. The word stdio has the full form standard input output and in programming the word std input represents
keyboard and the word std output represent monitor. Thus the header "stdio.h" provides us support for keyboard
and monitor in our program. This support is the ability to perform two important activity called input(accepting data
from the user) and output(displaying some text on monitor). To perform these two activities we get two functions
from stdio.h called "scanf()" and "printf()" respectively. The function scanf() allow us to perform input and the
function printf() allow us to perform output. Since input/output are two essential activities , so the header file
stdio.h is always present in almost in every C program.
====================================================
Q. What is conio.h ? Why it is used ?
Ans. The word conio stand for console input/output and in programming , console means output window i.e. the
window where result of execution of our program gets display. The header file 'conio.h' provides us a collection of
multiple functions using which we can easily manage the console window . Some of its important functions are
1) clrscr() - used for erasing the text on console
2) getch() - used for pausing the console window
3) textcolor() - used for changing the font color on console
4) gotoxy() - used for placing the cursor at desired position on console.
=====================================================
Q. What is the symbol of # called ? What is #include ?
Ans. The symbol of # in C Language is called "pound" and any statement in C which begin with # is called "Pre-
Processor Directives" . These preprocessor directives are special instruction which are not handled by the compiler
. Instead they are read and handled by another special software called "Pre-Processor" . The pre-processor reads
our program before the compiler read it and after making some important changes in our code it send the code to
the Compiler . Every pre-processor directive begin with # and following are some of them
1) #include - File Inclusion Directive
2) #define - Macro Creation Directive
3) #undef - Macro Removable Directive
4) Conditional Compilation Directive(CCD)
#if
#elif
#else
#endif
#ifdef
#ifndef
Amongs all the above pre-processor directives, the most popular is the file Inclusion directive "#include" . This
directive is used to attached the header files in our program . Whenever the pre-processor finds #include directive in
our program , it simply removes the #include statement and copies the contents of the mentioned header file in its
place . Due to this no. of line in our "source code" get increased and it now becomes "expanded source code" . This
expanded source code is then compiled by the compiler and the machine code gets generated. Finally this machine
code is executed by the CPU and we get output of our program.
======================================================
Compilation of C Program
====================
To compile C Program in Turbo IDE , we have two options :
1) Using the compile menu from the menubar.
2) Using the Keyboard shortcut "Alt + F9".
Q. What happen when we compile C Program ?
Ans. Whenever the compilation of C/C++ program is done then at first the pre-processor converts "source code"
into "expanded source code" and passes it to the compiler .
The Compiler then perform two activities :
1) It checks the complete program and findout "Syntax Error" in it. In case any error is presents , the compilation
process stops oterwise step 2 is taken
2) The compiler converts the "Expanded source code" into the corresponding "machine code(unexecutable)->object
code".
============================================
Execution of C Program
==================
To execute C Program in Turbo IDE , we have two options :
1) Using the RUN menu from the menubar.
2) Using the keyboard shortcut "Ctrl + F9".
Whenever we execute our program its output gets display on the "Console Window"