In this section we are going to provide C Programming introduction,Why use c programming,Advantages and disadvantages of C language,Why c is called middle level language,General Structure of c programs, and examples etc .
Previous | Home | Next |
C Programming introduction
C is a programming language developed by AT & T’s Bell Laboratories of USA in 1972. C was originally designed for and implemented on the UNIX operating system on the DEC PDP-11, by Dennis Ritchie.It is a basically an outgrowth of two earlier language called BCPL and B .
In C there are 32 keywords and 40 operators.C is a general-purpose programming language with features economy of expression, modern flow control and data structures, and a rich set of operators.C is not a ``very high level'' language, nor a ``big'' one, and is not specialized to any particular area of application.
Why use C programming ?
C language is very prevalent in creating different applications and writing of several different software source-codes. The essential feature comprising C language includes the simple and straight-forward use of compiler with a low-level access to memory.
C programming is structure programming language we can add no. of module (function) according to our need. Here are some examples of structured and non structured languages:
Non Structured | Structured |
FORTRAN | Pascal |
COBOL | C++ |
C | |
Java | |
Modula-2 |
Advantages of C language
- C is a general-purpose programming language with features economy of expression, modern flow control and data structures, and a rich set of operators.
- C programming is structure programming language we can add no. of module (function) according to our need.
Disadvantages of C language
- There is no runtime checking.
- There is no strict type checking (for ex: we can pass an integer value for the floating data type).
- As the program extends it is very difficult to fix the bugs.
Why C is called middle level language ?
C is called middle level language because it is actually binding the gap between a machine level language and more conventional high level languages. user can use c language to do system programming (for writing operating system) as well as application programming (for generate menu driven customer billing system ). So that is called middle level language .
High level Language
Ada , Modula-2 , Pascal, COBOL, FORTRAN, BASIC
Middle level Language
Java , C++ , C, FORTH, Macro-assemble
Low level Language
Assembler
General Structure of c program
- Document section
- Pre-processor section
- Global section
- Main() Section
{
} - User-Defined section
-
Document section
This section is related with user comment section .user can add comment two ways :
Single line comment: for single line comment user can add // two forward slash before for single line. User can add number of // single line comment in program.
Example:
Multiline comment: for multiline comment user can add /* */ User can add number of multiline comment.
Example:
/* this is multiline comment this is multiline comment this is multiline comment this is multiline comment this is multiline comment this is multiline comment */
-
Pre-processer Directive section
Normally every c program started with some Header files .that is called pre-processor section.
Pre-processor section is a section where number of header files are included .basically its helpful to link some files with c program. With help of different header files we can access different function easily.
Example:
for access sqrt(), printf(), scanf(), getch(), functions different header files like:
#include<stdio.h>, #include<conio.h> , #include<math.h>
-
Global Declaration Section
Global section is helpful to declare some variable which we can access in all over program. Basically before main function we can declare different global variable. We can access those variable in all over program.
-
Main Function section
In c language there must be a main() function.this section contain two parts.
Declaration part: for declare variables
Execution part all statements between{…………} these braces are execute by c compiler.
-
User defined section
Users can add number of different function with different data type ..he can add called same function number of times in main() function also.
Example of “general structure of C program”
// this is comment section. #include //these are header files #include int a; // this is global section void main() // this is main section { Printf(“this is main section”) ; } int function() // this is user defined section { Printf(“this is user defined section”);
Is C case sensitive language ?
Yes … in capital letter and lower letter have different meaning in c language .so c language is a case sensitive language.
How to Execute a program in C ?
Creating a executable form of our C program have a three steps:
- Creating our program
- Compiling our program
- Linking our program
Creating our program
first we create our program in c language. that have a Document section, Pre processor section, global declaration section, main section, user defined section. With these section we create c program.
Compiling our program
after creating our program we do the compile that program. After compiling program that convert the program in .obj extension.
Linking our program
After finish these two steps we do linking of the program, linking time that include a some library files. After linking the program that create a .exe file of that program and that exe file always be execute. These three steps showing in the diagram
Previous | Home | Next |
// this is single line comment