SlideShare a Scribd company logo
1 of 7
PREPROCESSORS IN C
BY
SAHITHI NARAPARAJU
INTRODUCTION:

One of the unique feature of C language is
preprocessor.

The preprocessor is a program that processes
the source code before it passes through
compiler.

Pre processor directives are divided into 3
categories:
1.
Macro substitution directives
2.
File inclusion directives
3.
Compiler control directives
MACRO SUBSTITUTION :
 Macro substitution is a process where an
identifier in a program replaced by predefined
string composed of one or more tokens.
 It is achieved by #define directive.
FILE INCLUSION :
 An external file containing functions or macro
definition can be included as apart of program
so that we need not rewrite those function or
macro definition.
 This is achieved by #include directive.
ADDITIONAL PREPROCESSOR
DIRECTIVES
#ELIF DIRECTIVE: #ELIF enables us to establish
an if else if sequence for testing multiple
conditions.
 #PRAGMA DIRECTIVE: #PRAGMA is an
implementation oriented directive that allows us to
specify various instructions to be given to
compiler.
Syntax: #pragma name

#ERROR : #ERROR directive is used to
produce diagnostic messages during
debugging.
Syntax: #error error message.

PREPROCESSOR OPERATORS
There are 2 preprocessor operations namely:
1.
Stringizing operator #
2.
Token pasting operator ##

Stringizing operator #: It is used in definition of
macro functions.
This
operator allows a formal argument within a macro
definition to be converted to a string.
Syntax:
#define sum(XY)printf(#xy”=%fn”,xy);

Token pasting operator ##:
 The token pasting operator enables us to
combine two tokens within a macro definition
to form a single token.
Syntax:
#define combine(string1,string2) s1##s2.

More Related Content

What's hot (20)

Programming in c
Programming in cProgramming in c
Programming in c
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
C if else
C if elseC if else
C if else
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
User Defined Functions
User Defined FunctionsUser Defined Functions
User Defined Functions
 
Introduction to c++ ppt
Introduction to c++ pptIntroduction to c++ ppt
Introduction to c++ ppt
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
String functions in C
String functions in CString functions in C
String functions in C
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Preprocessors
PreprocessorsPreprocessors
Preprocessors
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 

Viewers also liked

Viewers also liked (20)

Preprocessors
Preprocessors Preprocessors
Preprocessors
 
The C Preprocessor
The C PreprocessorThe C Preprocessor
The C Preprocessor
 
Macro
MacroMacro
Macro
 
System Programming Unit II
System Programming Unit IISystem Programming Unit II
System Programming Unit II
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Web Project Presentation - JoinPakForces
Web Project Presentation - JoinPakForcesWeb Project Presentation - JoinPakForces
Web Project Presentation - JoinPakForces
 
C++ Preprocessor Directives
C++ Preprocessor DirectivesC++ Preprocessor Directives
C++ Preprocessor Directives
 
Basic Input and Output
Basic Input and OutputBasic Input and Output
Basic Input and Output
 
Sexuality education
Sexuality educationSexuality education
Sexuality education
 
Implementation of c string functions
Implementation of c string functionsImplementation of c string functions
Implementation of c string functions
 
What is c
What is cWhat is c
What is c
 
Chapter 2: The Recording Process
Chapter 2: The Recording ProcessChapter 2: The Recording Process
Chapter 2: The Recording Process
 
Embedded C workshop
Embedded C workshopEmbedded C workshop
Embedded C workshop
 
C string
C stringC string
C string
 
C programming - String
C programming - StringC programming - String
C programming - String
 
Sex education
Sex educationSex education
Sex education
 
String in c
String in cString in c
String in c
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 

Similar to pre processor directives in C

Similar to pre processor directives in C (20)

C programming session6
C programming  session6C programming  session6
C programming session6
 
Preprocessor directives in c laguage
Preprocessor directives in c laguagePreprocessor directives in c laguage
Preprocessor directives in c laguage
 
Preprocessor.pptx
Preprocessor.pptxPreprocessor.pptx
Preprocessor.pptx
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
PreProcessorDirective.ppt
PreProcessorDirective.pptPreProcessorDirective.ppt
PreProcessorDirective.ppt
 
Chapter 13.1.11
Chapter 13.1.11Chapter 13.1.11
Chapter 13.1.11
 
1 - Preprocessor.pptx
1 - Preprocessor.pptx1 - Preprocessor.pptx
1 - Preprocessor.pptx
 
Preprocessor directives
Preprocessor directivesPreprocessor directives
Preprocessor directives
 
Unit 5 quesn b ans5
Unit 5 quesn b ans5Unit 5 quesn b ans5
Unit 5 quesn b ans5
 
Unit 5 quesn b ans5
Unit 5 quesn b ans5Unit 5 quesn b ans5
Unit 5 quesn b ans5
 
Ss debuggers
Ss debuggersSs debuggers
Ss debuggers
 
Oosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction partOosd lecture unit 4 ppt introduction part
Oosd lecture unit 4 ppt introduction part
 
6 preprocessor macro header
6 preprocessor macro header6 preprocessor macro header
6 preprocessor macro header
 
Training 8051Report
Training 8051ReportTraining 8051Report
Training 8051Report
 
Explain the motivation behind using a header file for a C program-Solu.docx
Explain the motivation behind using a header file for a C program-Solu.docxExplain the motivation behind using a header file for a C program-Solu.docx
Explain the motivation behind using a header file for a C program-Solu.docx
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
 
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
Preprocessor Directive in C
 

More from Sahithi Naraparaju

documentation for identity based secure distrbuted data storage schemes
documentation for identity based secure distrbuted data storage schemesdocumentation for identity based secure distrbuted data storage schemes
documentation for identity based secure distrbuted data storage schemesSahithi Naraparaju
 
SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...
SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...
SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...Sahithi Naraparaju
 
literature survey for identity based secure distributed data storage
literature survey for identity based secure distributed data storage literature survey for identity based secure distributed data storage
literature survey for identity based secure distributed data storage Sahithi Naraparaju
 
Identity based secure distributed data storage schemes
Identity based secure distributed data storage schemesIdentity based secure distributed data storage schemes
Identity based secure distributed data storage schemesSahithi Naraparaju
 
Srs document for identity based secure distributed data storage schemes
Srs document for identity based secure distributed data storage schemesSrs document for identity based secure distributed data storage schemes
Srs document for identity based secure distributed data storage schemesSahithi Naraparaju
 
66913017 java-ring-1217949449014046-9 (1)
66913017 java-ring-1217949449014046-9 (1)66913017 java-ring-1217949449014046-9 (1)
66913017 java-ring-1217949449014046-9 (1)Sahithi Naraparaju
 
Self protecteion in clustered distributed system new
Self protecteion in clustered distributed system newSelf protecteion in clustered distributed system new
Self protecteion in clustered distributed system newSahithi Naraparaju
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CSahithi Naraparaju
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in CSahithi Naraparaju
 
Steps for Developing a 'C' program
 Steps for Developing a 'C' program Steps for Developing a 'C' program
Steps for Developing a 'C' programSahithi Naraparaju
 
Self protecteion in clustered distributed system new
Self protecteion in clustered distributed system newSelf protecteion in clustered distributed system new
Self protecteion in clustered distributed system newSahithi Naraparaju
 
A Batch-authenticated And Key Agreement Framework For P2p-based Online Social...
A Batch-authenticated And Key AgreementFramework For P2p-based Online Social...A Batch-authenticated And Key AgreementFramework For P2p-based Online Social...
A Batch-authenticated And Key Agreement Framework For P2p-based Online Social...Sahithi Naraparaju
 

More from Sahithi Naraparaju (16)

PPT FOR IDBSDDS SCHEMES
PPT FOR IDBSDDS SCHEMESPPT FOR IDBSDDS SCHEMES
PPT FOR IDBSDDS SCHEMES
 
documentation for identity based secure distrbuted data storage schemes
documentation for identity based secure distrbuted data storage schemesdocumentation for identity based secure distrbuted data storage schemes
documentation for identity based secure distrbuted data storage schemes
 
SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...
SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...
SYSTEM ARCHITECTURE / UML DIAGRAMS FOR IDENTITY BASED SECURE DISTRIBUTED DATA...
 
over view of viruses
over view of virusesover view of viruses
over view of viruses
 
literature survey for identity based secure distributed data storage
literature survey for identity based secure distributed data storage literature survey for identity based secure distributed data storage
literature survey for identity based secure distributed data storage
 
Identity based secure distributed data storage schemes
Identity based secure distributed data storage schemesIdentity based secure distributed data storage schemes
Identity based secure distributed data storage schemes
 
Srs document for identity based secure distributed data storage schemes
Srs document for identity based secure distributed data storage schemesSrs document for identity based secure distributed data storage schemes
Srs document for identity based secure distributed data storage schemes
 
66913017 java-ring-1217949449014046-9 (1)
66913017 java-ring-1217949449014046-9 (1)66913017 java-ring-1217949449014046-9 (1)
66913017 java-ring-1217949449014046-9 (1)
 
Self protecteion in clustered distributed system new
Self protecteion in clustered distributed system newSelf protecteion in clustered distributed system new
Self protecteion in clustered distributed system new
 
OVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAMOVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAM
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN C
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
Steps for Developing a 'C' program
 Steps for Developing a 'C' program Steps for Developing a 'C' program
Steps for Developing a 'C' program
 
Self protecteion in clustered distributed system new
Self protecteion in clustered distributed system newSelf protecteion in clustered distributed system new
Self protecteion in clustered distributed system new
 
A Batch-authenticated And Key Agreement Framework For P2p-based Online Social...
A Batch-authenticated And Key AgreementFramework For P2p-based Online Social...A Batch-authenticated And Key AgreementFramework For P2p-based Online Social...
A Batch-authenticated And Key Agreement Framework For P2p-based Online Social...
 
Haptic technology
Haptic technologyHaptic technology
Haptic technology
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

pre processor directives in C

  • 2. INTRODUCTION:  One of the unique feature of C language is preprocessor.  The preprocessor is a program that processes the source code before it passes through compiler.  Pre processor directives are divided into 3 categories: 1. Macro substitution directives 2. File inclusion directives 3. Compiler control directives
  • 3. MACRO SUBSTITUTION :  Macro substitution is a process where an identifier in a program replaced by predefined string composed of one or more tokens.  It is achieved by #define directive. FILE INCLUSION :  An external file containing functions or macro definition can be included as apart of program so that we need not rewrite those function or macro definition.  This is achieved by #include directive.
  • 4. ADDITIONAL PREPROCESSOR DIRECTIVES #ELIF DIRECTIVE: #ELIF enables us to establish an if else if sequence for testing multiple conditions.  #PRAGMA DIRECTIVE: #PRAGMA is an implementation oriented directive that allows us to specify various instructions to be given to compiler. Syntax: #pragma name 
  • 5. #ERROR : #ERROR directive is used to produce diagnostic messages during debugging. Syntax: #error error message. 
  • 6. PREPROCESSOR OPERATORS There are 2 preprocessor operations namely: 1. Stringizing operator # 2. Token pasting operator ##  Stringizing operator #: It is used in definition of macro functions. This operator allows a formal argument within a macro definition to be converted to a string. Syntax: #define sum(XY)printf(#xy”=%fn”,xy); 
  • 7. Token pasting operator ##:  The token pasting operator enables us to combine two tokens within a macro definition to form a single token. Syntax: #define combine(string1,string2) s1##s2.