Introduction to C Programming :
First to learn C Programming you have to download a compiler like Turbo C/C++, Borland C++ or Code Blocks IDE from any web Site
like :
http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12-setup.exe/download
http://borland-c.software.informer.com/5.5/
http://turbo-c.soft32.com/
But I always prefer to download Turbo C/C++ or Borland C++ .
Turbo C/C++ mainly used in school programming,computer center course etc like this .
But in BorlandC++ you is generally used in home purpose for learning c quickly at home .You can copy your program with CTRL+C , or cut your program CTRL+X or paste your program with CTRL+V .
You can't do this in Turbo C .
But without having this feature TurboC/C++ has many benefit to install.
You can feel this when you face the problem .
So I suggest you to download and install TurboC++ and BorlandC++ both.
How to install TurboC++ :
After downloading TurboC++ you have to install it .
How to install TurboC++ ?
Don't hesitate , I am giving you the answer how to install TurboC++ step by step .
First : click on the icon of Turbo C++
Second : A window will open then click on NEXT .
Third : Then click on the check box that refers you accept.
Fourth :Then again click on NEXT.
Fifth : Then click on BROWSE to select destination folder where to install .
Sixth :Select your destination folder.
Seventh :Click on INSTALL to instal TurboC++ .
Final Step : Click on finish .
Now Your TurboC++ is ready to use .
How to exit from Turbo C++ :
After opening Turbo C++ it is easy to exit from here .
How is it ?
Click on the option "FILE" in upper-left corner .
Now click on "QUIT" .
That's it !
Is not easy ?
C is a remarkable language. Designed originally by Dennis Ritchie, working at AT&T Bell
Laboratories in New Jersey, it has increased in use until now it may well be one of the most widely written
computer languages in the world. C is a structured language. It allows variety of programs
in small modules. It is easy for debugging, testing, and maintenance if a language is a structured
one.
Structure of a C Program :
Include header file section
Global declaration section
main()
{
Declaration part
Executable part
}
User-defined functions
{
Statements
}
Include Header File Section:
C program depends upon some header files for function definition that are used in program.
Each header file by default is extended with .h. The header file should be included using # include
directive as given here.
Global Declaration :
This section declares some variables that are used in more than one function. These variables
are known as global variables. This section must be declared outside of all the functions.
Function Main :
Every program written in C language must contain main () function. The function main() is
a starting point of every C program. The execution of the program always begins with the function
main ().
Declaration Part :
The declaration part declares the entire variables that are used in executable part. The
initializations of variables are also done in this section. Initialisation means providing initial value
to the variables.
Executable Part :
This part contains the statements following the declaration of the variables. This part conatins
a set of statements or a single statement. These statements are enclosed between the braces.
User Defined Function :
The functions defined by the user are called user-defined functions. These functions are
generally defined after the main () function.
Steps For Executing the Program :
1.Creation of program
Programs should be written in C editor. The file name does not necessarily include extension
C. The default extension is C.
2. Compilation of a program
The source program statements should be translated into object programs which is suitable
for execution by the computer. The translation is done after correcting each statement. If
there is no error, compilation proceeds and translated program are stored in another file
with the same file name with extension “.obj”.
3. Execution of the program
After the compilation the executable object code will be loaded in the computers main
memory and the program is executed.
Basic C Keywords :
Auto | Double | Int | Struct
Break | Else | Long | Switch
Case | Enum | Register | Typedef
Char | Extern | Return | Union
Const |Float |Short | Unsigned
Continue | For | Signed | Void
Default | Goto | Sizeof | Volatile
Do | If | Static | while
Delimiters Use :
: Colon Useful for label
; Semicolon Terminates the statement
( ) Parenthesis Used in expression and function
[ ] Square Bracket Used for array declaration
{ } Curly Brace Scope of the statement
# hash Preprocessor directive
, Comma Variable separator
No comments:
Post a Comment