C Preprocessors Programs

In C programming language, the preprocessors are the programs that process the source code before the compilation. We can say that preprocessors are not the part of the program compilation, it's a separate process which process the code before the compilation.

There are following preprocessor directives in C programming language,

Preprocessor Directives Description
#define To define a preprocessor macro.
#include To include the code from another file or to include header file in the current code.
#undef To undefine a defined preprocessor macro.
#ifdef To check whether a macro is defined or not, it returns true if macro is defined.
#ifndef To check whether a macro is defined or not, it returns true if macro is not defined.
#if, #else, #elif, #endif To control the compilation of portions of a source code.
#error To print the error message on stderr.
#pragma To issue special commands to the compiler, using a standardized method.

C Preprocessors Programs/Examples: This section contains the C solved programs on C preprocessors, practice these programs to learn the concept of C preprocessors. Each program contains the solved code, output and explanations.

List of C Preprocessors Programs

  1. The #if directive Example in C
  2. The #if ... #else directive Example in C
  3. The # Preprocessor Operator Example in C
  4. The ## Preprocessor Operator Example in C
  5. The __LINE__ Macro Example in C
  6. Print the current function name by using __func__ in C
  7. The #line directive Example in C
  8. Define Macros for YES and NO constants using #define in C
  9. Define a function like Macro that should use printf in C
  10. Define Macro PRINT to print given integer argument in C
  11. Define Macros to SET and CLEAR bit of a PIN in C
  12. Define Macro to toggle a bit of a PIN in C
  13. Define a Macro to set Nth bit to Zero in C
  14. Define a constant using Macro to use in Array declarations in C
  15. How to redefine a Macro in C?
  16. How to check whether a Macro is defined or not in C?
  17. Print argument (i.e. variable name, value) using Macro in C
  18. Print error message from any function with function name, line number in C.
  19. Macro Arguments Evaluation in C
  20. Define a Macro to find total number of elements in C
  21. Define a Macro to round a float value to nearest integer in C
  22. C program to print the function names defined in the source code
  23. C program to print the name of the source code file
  24. C program to print the line number in source code with filename and function name

Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.