Monthly archives of “December 2012

comment 0

Basic of C/C++ – Day 1

Overview

  • The C/C++ executable contains machine code which will be execute directly by the processor
  • Usually every C/C++ program starts with the method void main()
  • A program, whatever its size, consist of functions and variables. A function contains statements that specify the computing operations to be done, and variables store values used during the computation.

Compile and Linking Process

To produce an executable program from the source code requires a 3-stage process :

  • Pre-process: First the C pre-processor is run on each source file. This interprets pre-processor directives, which ¬†are indicated by the # symbol. The output of the preprocessor will be files containing C/C++ code.
  • Compile: The expanded source code file resulting from pre-processing is compiled to produce an object file containing the raw machine instructions.
  • Linking: The Linker combines one or more object files together with standard libraries (which contain collections of object files). This is the program that one actually runs.