C++

PreProcessing – Hinting the compiler

  • The C preprocessor (cpp) is the macro preprocessor for C and C++.

 

  • It is used for:

1)conditional compilation

2)inclusion of header files

3) macro expansion

4) special macros(__LINE__,__FILE__)

 

1) #if DEBUG

   #elseif RELEASE

   #elif

   #endif
2) #include <stdio.h>

And Also

#pragma once

replaces the old syntax

#ifndef FunctionName

#define FunctionName

#endif
3)
#define <MacroName> <list of keys/tokens> 
#define <MacroName>(<list of parameters>) <list of keys/tokens>  
4)
printf("line=%d file=%s\n", __LINE__, __FILE__);