Features of C Language
Features of C Language
The C Language is developed by Dennis Ritchie for creating system applications that
directly interact with the hardware devices such as drivers, kernels, etc.
Features of C Language
1. Simple
5. Rich Library
6. Memory Management
7. Fast Speed
8. Pointers
9. Recursion
10.Extensible
First C Program
Before starting the abcd of C language, you need to learn how to write, compile and
run the first c program.
To write the first c program, open the C console and write the following code:
1. #include <stdio.h>
2. int main(){
3. printf("Hello C Language");
4. return 0;
5. }
return 0 The return 0 statement, returns execution status to the OS. The 0 value is
used for successful execution and 1 for unsuccessful execution.
Compilation process in c
What is a compilation?
The compilation is a process of converting the source code into object code. It is
done with the help of the compiler. The compiler checks the source code for the
syntactical or structural errors, and if the source code is error-free, then it generates
the object code.
The following are the phases through which our program passes before being
transformed into an executable form:
o Preprocessor
o Compiler
o Assembler
o Linker
Preprocessor
The source code is the code which is written in a text editor and the source code file
is given an extension ".c". This source code is first passed to the preprocessor, and
then the preprocessor expands this code. After expanding the code, the expanded
code is passed to the compiler.
Compiler
The code which is expanded by the preprocessor is passed to the compiler. The
compiler converts this code into assembly code. Or we can say that the C compiler
converts the pre-processed code into assembly code.
Assembler
The assembly code is converted into object code by using an assembler. The name
of the object file generated by the assembler is the same as the source file. The
extension of the object file in DOS is '.obj,' and in UNIX, the extension is 'o'. If the
name of the source file is 'hello.c', then the name of the object file would be
'hello.obj'.
Linker
Mainly, all the programs written in C use library functions. These library functions
are pre-compiled, and the object code of these library files is stored with '.lib' (or
'.a') extension. The main working of the linker is to combine the object code of
library files with the object code of our program. Sometimes the situation arises
when our program refers to the functions defined in other files; then linker plays a
very important role in this. It links the object code of these files to our program.
Therefore, we conclude that the job of the linker is to link the object code of our
program with the object code of the library files and other files. The output of the
linker is the executable file. The name of the executable file is the same as the
source file but differs only in their extensions. In DOS, the extension of the
executable file is '.exe', and in UNIX, the executable file can be named as 'a.out'. For
example, if we are using printf() function in a program, then the linker adds its
associated code in an output file.
hello.c
1. #include <stdio.h>
2. int main()
3. {
4. printf("Hello javaTpoint");
5. return 0;
6. }