Introduction to C Programming (Day 1)
C is a powerful and effective programming language. We can create System software, Embedded hardware and application software by programming with C. C is popularly termed as the successor of basic combined programming language known as B. The B language was implemented in 1960 at Cambridge University. Embedded C programming is an essential tool for all electronic engineers and developers.Here i-St@r gives you the better opportunity to study C and Embedded C programming languages. We plan to cover C in 7 days. You can study C in one week, if you make use of this site effectively. After 7 days you may be able to develop basic application program and embedded program for microcontrollers (PIC).
Development of C language
The development of C language is directly related to the Unix operating system development. C was invented by Dennis Richey and Barian.W in 1972 at Bell laboratory. C language is compatible with Windows, Dos and Unix operating systems. The Unix operating system is mainly used for C language development. The coding done in Unix and the coding method of C is almost similar in structure. Unix operating system was also developed from Cambridge university.Importance of C language
C programming language has accurate frame structure, so we can call it as a structural programming language. There are wide varieties of functions and operators available in C, it is possible to develop complex programs, system software, embedded hardware and application software by manipulating these operators and functions. Group of programs that helps the working of a computer is known as system software, for example- Compiler, Interpreter, Operating system, etc. Application software is nothing but a group of programs that control a single application only; for example MS Word, MS Power point, etc. C programming is a free language, that is it can run be in any computer as well. Also the portability feature makes C language more popular. The programs written in C language are very efficient and effective. For example to add 1 to 10 numbers using C language, it takes lower time as compared to that of written in Basic.Method of Coding in C
In normal case we are using small letter English alphabets for program coding, but capital letters can also be used. Capital letters are often used for defining some constants or variables. Another symbol for C language coding is ‘{}’ brackets. It is used to include the group of codes together while a program is executing. This helps the programmer to easily identify the faults and errors in the program. We can write the coding statements in any row, because C is an independent programming language. Consider an example, a=b+c;d=e-f;
i=a*b;
Above statements can also be written in single line as,
a=b+c; d=e-f; i=a*b;
It is important to provide semicolon ‘;’ at the end of any statement.
Stages of a C program
Programming language is a medium for communication between a computer and a user. Before studying C programming we must be aware of the different symbols, words, syntax etc. used in C language. The following are the different stages in a C program.- Creating the program
- Compiling the program
- Linking the program
- Execution of the program
Creating the program
A computer is ready to accept different programs after loading the operating system in to the memory of that computer. Now we are going to give program codes using input devices. These codes should be in the form of a File. A file name contains two parts- File name and Extension name. These two parts are separated by a period (.). In this, the Extension name indicates the behavior of that file. For example a C program file consisting of a name followed by .C extension. That is istar.c (Red colour indicates the extension)Compiling a program
After the development of a program, we must convert it in to machine level language from high level language because computer knows machine level language only. The media for this conversion is called as compiler. Compiler is simply a translating program, it translate High level language to machine level language. The high level language programs written by the programmer are called source codes. These source codes are then converted to machine level language using compiler, and then it is known as objective program. A compiler is capable of identifying the syntax errors in the program but it can’t identify the logical mistakes.Linking the program
The process of connecting all the functions and other programs together for creating our program is called linking. For example the object code of printf() function is stored in the library files of the system, so at the stage of linking the object codes in library file is linked to the main funcuin.Executing the program
The object code execution starts after the finishing of linking process. User gives the necessary inputs at this stage.
Ads
0 comments:
Post a Comment