All posts filed under “C++

comment 0

Basic of C/C++ – Day 2

Types, Operators and Expressions

  • Variables and constants are the basic data object manipulated in a program.
  • Expressions combine variables and constants to produce new values.
  • All variables must be declared before they are used, usually at the begining of the function before any executable statements.
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.