C C++ Programming Assignment Help

C is a middle level programming language.

C is a programming language that is extremely popular, simple and flexible. It is machine-independent, structured programming language. 'C' was developed by Dennis Ritchie in 1972.

All lines that start with # are processed by preprocessor which is a program invoked by the compiler in C programming language.Preprocessor takes a C program and produces another C program. The produced program hasno lines starting with #, all such line are processed by the preprocessor. Preprocessor copies the preprocessed code of stdio.h to our file.The .h files are called header files in C. These header files generally contain declaration of functions.

What goes inside the compilation process?

Compiler converts a C program into an executable. There are four phases for a C program to become an executable:
  1. Pre-processing
  2. Compilation
  3. Assembly
  4. Linking

Pre-Processing:This is the first phase through which source code is passed. This phase include:

  1. Removal of Comments
  2. Expansion of Macros
  3. Expansion of the included files
The preprocessed output is stored in the filename.i

Compilation:The next step is to compile filename.i and produce an; intermediate compiled output file filename.s. This file is in assembly level instructions.

Assembly:In this phase the filename.s is taken as input and turned into filename.o by assembler. This file contain machine level instructions. At this phase, only existing code is converted into machine language, the function calls like printf() are not resolved.

Linking:This is the final phase in which all the linking of function calls with their definitions are done.Linker knows where all these functions are implemented.

Following are some interesting facts about preprocessors in C.
  1. When we use include directive, the contents of included header file (after preprocessing) are copied to the current file.
  2. When we use define for a constant, the preprocessor produces a C program where the defined constant is searched and matching tokens are replaced with the given expression.
  3. The macros can take function like arguments, the arguments are not checked for data type.For example, the following macro INCREMENT(x) can be used for x of any data type.

    Example

                               #include 
                                #define INCREMENT(x) ++x
                                int main()
                                {
                                char *ptr = "QuickHelp";
                                int x = 10;
                                printf("%s ", INCREMENT(ptr));
                                printf("%d", INCREMENT(x));
                                return 0;
                                }
                           

    Output:

    uickHelp11

Applications

  1. 'C' Programming is widely used in embedded systems, used for developing system applications, desktop applications
  2. Most of the software by Adobe are developed using 'C' language.
  3. MySQL database software which is also built using 'C'.
  4. Operating systems such as Microsoft's Windows , Apple's OS X,and Symbian are developed using 'C' language.
Plagiarism Checker

NEW YEAR OFFER 50% OFF !!! Order Now

NEW YEAR OFFER 50% OFF !!

Lets take Best opinion from our Expert Tutors Today! Order Now