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.
Pre-Processing:This is the first phase through which source code is passed. This phase include:
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.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
NEW YEAR OFFER 50% OFF !!! Order Now
NEW YEAR OFFER 50% OFF !!
Lets take Best opinion from our Expert Tutors Today! Order Now
*Disclaimer: The reference papers provided by QuickAssignmentHelp.net serve as model papers for students and not to be submitted as it is. These papers are intended to used for research and reference purposes only.
Copyright © 2024 QuickAssignmentHelp.net All right reserved.