C Processor And Macros

Prashant | Wed, 10 Jun, 2020 | 155

C processors and macros

In this tutorial we will learn about macros and prepocessors, and you will also learn  about how to use and #inlcude #define and conditional compilations.

The C preprocessor is a macro preprocessor (allows you to define macros) that transforms your program before it is compiled. These transformations can be the inclusion of header file, macro expansions etc.

All preprocessing directives begin with a # symbol. For example,

#define PI 3.14
#include <stdio.h>

All preprocessor commands begin with a hash symbol (#). It must be the first nonblank character, and for readability, a preprocessor directive should begin in the first column. The following section lists down all the important preprocessor directives −

Sr.NoDirectives & Descriptions
1#define
Substitutes a preprocessor macro.
2#include
Inserts a particular header from another file.
3#undef
Undefines a preprocessor macro.
4#ifdef
Returns true if this macro is defined.
5#ifndef
Returns true if this macro is not defined.
6#if
Tests if a compile time condition is true.
7#else
The alternative for #if.
8#elif
#else and #if in one statement.
9#endif
Ends preprocessor conditional.
10#error
Prints error message on stderr.
11#pragma
Issues special commands to the compiler, using a standardized method.

Predefined Macros −

ANSI C defines a number of macros. Although each one is available for use in programming, the predefined macros should not be directly modified.

Sr.NoMacro & Descriptions
1__DATE__
The current date as a character literal in "MMM DD YYYY" format.
2__TIME__
The current time as a character literal in "HH:MM:SS" format.
3__FILE__
This contains the current filename as a string literal.
4__LINE__
This contains the current line number as a decimal constant.
5__STDC__
Defined as 1 when the compiler complies with the ANSI standard.

 

 

 

 

 

 

 

Related Articles :- 

1Introduction And Getting Started With C

2Basic Of C Language

3. Why We Should Use C Language

4. Applications Of C Programming

5. Basic Rules For Writting C Program

6. Keywords In C Language

7. Comments In C Programming

8. Tokens In C

9. Difference Between Int Main And Void Main

10. C Processor And Macros

11. Variables In C

12. Types Of Variables In C

13. Difference Between Local And Global Variable

14. Difference Bwtween Auto / Extern / Static Variable

15. Constant In C

16. How To Access Global Variable Using Extern Keyword In C

17. Exit And Return Staterment In C

18. Print Float Value Upto N Decimals In C Programming

19. How To Print Multiline Message Using Single Printf In C Programming ?

20. What Value Returned By Scanf Function In C Language ?

21. What Value Is Returned By Printf And Scanf In C

22. What Do 'Lvalue' And 'Rvalue' Mean In C/C++?

23. Errors In C Programming ?

10 comments

Edipobomizeqo    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Owuyoc <a href="http://slkjfdf.net/">Zuneqoiw</a> jsh.xtyf.selfcode.in.wqe.sh http://slkjfdf.net/


Rucuosalumowo    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Uwilir <a href="http://slkjfdf.net/">Epaduye</a> wns.nrdl.selfcode.in.rhm.bd http://slkjfdf.net/


Iasaalu    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Oaonic <a href="http://slkjfdf.net/">Nuseoize</a> ize.xckj.selfcode.in.ekh.qg http://slkjfdf.net/


Egiqexohiz    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Fokuusan <a href="http://slkjfdf.net/">Aqumwue</a> ctd.ugfw.selfcode.in.lgb.ur http://slkjfdf.net/


Ovanqpsujif    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Ilukaqoja <a href="http://slkjfdf.net/">Iquxoz</a> vmz.buup.selfcode.in.lsa.fl http://slkjfdf.net/


Ubuimoyoyyik    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Exilomuze <a href="http://slkjfdf.net/">Abejovoha</a> twb.gegq.selfcode.in.lfu.bf http://slkjfdf.net/


Sekuciba    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Zaadseab <a href="http://slkjfdf.net/">Ovewyof</a> vjw.bcqo.selfcode.in.kac.ul http://slkjfdf.net/


Uxyopizuk    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Uqoxanah <a href="http://slkjfdf.net/">Ajiumuqet</a> pda.nhfy.selfcode.in.tjc.mw http://slkjfdf.net/


Oyexupenus    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Olanecoy <a href="http://slkjfdf.net/">Olapuwopo</a> hzx.svop.selfcode.in.elh.gv http://slkjfdf.net/


Oqugotuno    Wed, 21 Apr, 2021

http://slkjfdf.net/ - Gubecu <a href="http://slkjfdf.net/">Olizeb</a> oua.yrip.selfcode.in.uqh.if http://slkjfdf.net/

Leave a comment