SlideShare a Scribd company logo
1 of 12
Disclaimer: This presentation is prepared by trainees of 
baabtra.com as a part of mentoring program. This is not 
official document of baabtra.com – Mentoring Partner
Preprocessor Directives 
In C 
Muhammed Thanveer Melayi 
Muhammedthanveermelayi@yahoo.com 
Muhammed Thanveer Melayi 
Twitter Profile 
Linkedin Profile
What is Preprocessors 
The C Preprocessor is not part of the compiler, but is a 
separate step in the compilation process. In simplistic 
terms, a C Preprocessor is just a text substitution tool and 
they instruct compiler to do required pre-processing before 
actual compilation 
All preprocessor commands begin with a pound symbol (#). It must be 
the first nonblank character, and for readability, a preprocessor directive 
should begin in first column
 important preprocessor directives 
Directive and Description 
The unconditional directives are: 
#include - Inserts a particular header from another file 
#define - Defines a preprocessor macro 
#undef - Undefines a preprocessor macro 
The conditional directives are: 
#ifdef - If this macro is defined 
#ifndef - If this macro is not defined 
#if - Test if a compile time condition is true 
#else - The alternative for #if 
#elif - #else an #if in one statement 
#endif - End preprocessor conditional 
Other directives include: 
# - Stringization, replaces a macro parameter with a string 
constant 
## - Token merge, creates a single token from two adjacent ones
Use of the preprocessor 
programs easier to develop 
easier to read 
easier to modify 
example 
#include <stdio.h> 
#define PI 3.1415 
int main() 
{ 
int radius; 
float area; 
printf("Enter the radius: "); 
scanf("%d",&radius); 
area=PI*radius*radius; 
printf("Area=%.2f",area); 
return 0; 
}
#ifdef and #endif in c 
It only checks identifier has been defied or not. 
#ifdef <Identifer> 
------------- 
------------- 
#else 
------------- 
------------- 
#endif 
Example 
#include<stdio.h> 
#define ABC 25 
#define PQR "Exact Help" 
int main(){ 
int num = 3; 
#ifdef ABC 
printf("%d",ABC * ABC); 
#else 
printf("%s",PQR); 
#endif 
return 0; 
} 
Output: 625
# error directive in c 
Syntax : #error 
it only issue an error message and this error message includes . 
Example 
#include<stdio.h> 
#ifndef __MATH_H 
#error First include then compile 
#else 
int main(){ 
float a,b=25; 
a=sqrt(b); 
printf("%f",a); 
return 0; 
} 
#endif 
Output: compiler error --> Error directive :First include then compile
Thank you
Want to learn more about programming or Looking to become a good programmer? 
Are you wasting time on searching so many contents online? 
Do you want to learn things quickly? 
Tired of spending huge amount of money to become a Software professional? 
Do an online course 
@ baabtra.com 
We put industry standards to practice. Our structured, activity based courses are so designed 
to make a quick, good software professional out of anybody who holds a passion for coding.
Follow us @ twitter.com/baabtra 
Like us @ facebook.com/baabtra 
Subscribe to us @ youtube.com/baabtra 
Become a follower @ slideshare.net/BaabtraMentoringPartner 
Connect to us @ in.linkedin.com/in/baabtra 
Give a feedback @ massbaab.com/baabtra 
Thanks in advance 
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us 
Emarald Mall (Big Bazar Building) 
Mavoor Road, Kozhikode, 
Kerala, India. 
Ph: + 91 – 495 40 25 550 
NC Complex, Near Bus Stand 
Mukkam, Kozhikode, 
Kerala, India. 
Ph: + 91 – 495 40 25 550 
Cafit Square, 
Hilite Business Park, 
Near Pantheerankavu, 
Kozhikode 
Start up Village 
Eranakulam, 
Kerala, India. 
Email: info@baabtra.com

More Related Content

Viewers also liked

Functions with heap and stack....by thanveer danish
Functions with heap and stack....by thanveer danishFunctions with heap and stack....by thanveer danish
Functions with heap and stack....by thanveer danishMuhammed Thanveer M
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiMuhammed Thanveer M
 
Aptitude model by thanveer danish
Aptitude model by thanveer danishAptitude model by thanveer danish
Aptitude model by thanveer danishMuhammed Thanveer M
 
mysql ....question and answer by muhammed thanveer melayi
mysql ....question and answer by muhammed thanveer melayimysql ....question and answer by muhammed thanveer melayi
mysql ....question and answer by muhammed thanveer melayiMuhammed Thanveer M
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
Test powerpoint presentation
Test powerpoint presentationTest powerpoint presentation
Test powerpoint presentationallaynew
 
Understanding c file handling functions with examples
Understanding c file handling functions with examplesUnderstanding c file handling functions with examples
Understanding c file handling functions with examplesMuhammed Thanveer M
 
Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)Adam Năm
 
Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)Adam Năm
 

Viewers also liked (15)

Functions with heap and stack....by thanveer danish
Functions with heap and stack....by thanveer danishFunctions with heap and stack....by thanveer danish
Functions with heap and stack....by thanveer danish
 
The basics of c programming
The basics of c programmingThe basics of c programming
The basics of c programming
 
Stored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayiStored procedures by thanveer danish melayi
Stored procedures by thanveer danish melayi
 
Codeinator
CodeinatorCodeinator
Codeinator
 
Aptitude model by thanveer danish
Aptitude model by thanveer danishAptitude model by thanveer danish
Aptitude model by thanveer danish
 
Transation.....thanveeer
Transation.....thanveeerTransation.....thanveeer
Transation.....thanveeer
 
Jvm
JvmJvm
Jvm
 
Data base by thanveer danish
Data base by thanveer danishData base by thanveer danish
Data base by thanveer danish
 
mysql ....question and answer by muhammed thanveer melayi
mysql ....question and answer by muhammed thanveer melayimysql ....question and answer by muhammed thanveer melayi
mysql ....question and answer by muhammed thanveer melayi
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
Test powerpoint presentation
Test powerpoint presentationTest powerpoint presentation
Test powerpoint presentation
 
Understanding c file handling functions with examples
Understanding c file handling functions with examplesUnderstanding c file handling functions with examples
Understanding c file handling functions with examples
 
Memory allocation in c
Memory allocation in cMemory allocation in c
Memory allocation in c
 
Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)
 
Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)Satellite communications by dennis roddy (4th edition)
Satellite communications by dennis roddy (4th edition)
 

Similar to C Preprocessor Directives

Preprocesser in c++ by thanveer danish
Preprocesser in c++ by thanveer danishPreprocesser in c++ by thanveer danish
Preprocesser in c++ by thanveer danishMuhammed Thanveer M
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c languagetanmaymodi4
 
Preprocessor directives in c laguage
Preprocessor directives in c laguagePreprocessor directives in c laguage
Preprocessor directives in c laguageTanmay Modi
 
Code tuning strategies
Code tuning strategiesCode tuning strategies
Code tuning strategiesAsha Sari
 
Continuous delivery its not about the technology, its about the people. @pipe...
Continuous delivery its not about the technology, its about the people. @pipe...Continuous delivery its not about the technology, its about the people. @pipe...
Continuous delivery its not about the technology, its about the people. @pipe...Tomas Riha
 
Five Phases of SAP Internships - Wizcore
Five Phases of SAP Internships - Wizcore Five Phases of SAP Internships - Wizcore
Five Phases of SAP Internships - Wizcore yakfurinnaaa
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddSrinivasa GV
 

Similar to C Preprocessor Directives (20)

Pre processor directives in c
Pre processor directives in cPre processor directives in c
Pre processor directives in c
 
C programming session6
C programming  session6C programming  session6
C programming session6
 
Preprocesser in c++ by thanveer danish
Preprocesser in c++ by thanveer danishPreprocesser in c++ by thanveer danish
Preprocesser in c++ by thanveer danish
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Unit 5 Part 1 Macros
Unit 5 Part 1 MacrosUnit 5 Part 1 Macros
Unit 5 Part 1 Macros
 
Anagha
AnaghaAnagha
Anagha
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c language
 
Preprocessor directives in c laguage
Preprocessor directives in c laguagePreprocessor directives in c laguage
Preprocessor directives in c laguage
 
Linq in asp.net
Linq in asp.netLinq in asp.net
Linq in asp.net
 
PreProcessorDirective.ppt
PreProcessorDirective.pptPreProcessorDirective.ppt
PreProcessorDirective.ppt
 
Feature Engineering in NLP.pdf
Feature Engineering in NLP.pdfFeature Engineering in NLP.pdf
Feature Engineering in NLP.pdf
 
Code tuning strategies
Code tuning strategiesCode tuning strategies
Code tuning strategies
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
Continuous delivery its not about the technology, its about the people. @pipe...
Continuous delivery its not about the technology, its about the people. @pipe...Continuous delivery its not about the technology, its about the people. @pipe...
Continuous delivery its not about the technology, its about the people. @pipe...
 
C programming
C programmingC programming
C programming
 
Five Phases of SAP Internships - Wizcore
Five Phases of SAP Internships - Wizcore Five Phases of SAP Internships - Wizcore
Five Phases of SAP Internships - Wizcore
 
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
 
Agile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tddAgile_goa_2013_clean_code_tdd
Agile_goa_2013_clean_code_tdd
 

More from Muhammed Thanveer M

Easy check is simple and easy use lodge management system
Easy check is simple and easy use lodge management systemEasy check is simple and easy use lodge management system
Easy check is simple and easy use lodge management systemMuhammed Thanveer M
 
KeyBan....easy to think and work
KeyBan....easy to think and workKeyBan....easy to think and work
KeyBan....easy to think and workMuhammed Thanveer M
 
Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Muhammed Thanveer M
 
Udf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiUdf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiMuhammed Thanveer M
 
Elements of c program....by thanveer danish
Elements of c program....by thanveer danishElements of c program....by thanveer danish
Elements of c program....by thanveer danishMuhammed Thanveer M
 

More from Muhammed Thanveer M (7)

Easy check is simple and easy use lodge management system
Easy check is simple and easy use lodge management systemEasy check is simple and easy use lodge management system
Easy check is simple and easy use lodge management system
 
KEYBAN...MODULES
KEYBAN...MODULES KEYBAN...MODULES
KEYBAN...MODULES
 
KeyBan....easy to think and work
KeyBan....easy to think and workKeyBan....easy to think and work
KeyBan....easy to think and work
 
Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)
 
Udf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayiUdf&views in sql...by thanveer melayi
Udf&views in sql...by thanveer melayi
 
Aptitude Questions-2
Aptitude Questions-2Aptitude Questions-2
Aptitude Questions-2
 
Elements of c program....by thanveer danish
Elements of c program....by thanveer danishElements of c program....by thanveer danish
Elements of c program....by thanveer danish
 

Recently uploaded

Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Recently uploaded (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

C Preprocessor Directives

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra.com as a part of mentoring program. This is not official document of baabtra.com – Mentoring Partner
  • 3. Preprocessor Directives In C Muhammed Thanveer Melayi Muhammedthanveermelayi@yahoo.com Muhammed Thanveer Melayi Twitter Profile Linkedin Profile
  • 4. What is Preprocessors The C Preprocessor is not part of the compiler, but is a separate step in the compilation process. In simplistic terms, a C Preprocessor is just a text substitution tool and they instruct compiler to do required pre-processing before actual compilation All preprocessor commands begin with a pound symbol (#). It must be the first nonblank character, and for readability, a preprocessor directive should begin in first column
  • 5.  important preprocessor directives Directive and Description The unconditional directives are: #include - Inserts a particular header from another file #define - Defines a preprocessor macro #undef - Undefines a preprocessor macro The conditional directives are: #ifdef - If this macro is defined #ifndef - If this macro is not defined #if - Test if a compile time condition is true #else - The alternative for #if #elif - #else an #if in one statement #endif - End preprocessor conditional Other directives include: # - Stringization, replaces a macro parameter with a string constant ## - Token merge, creates a single token from two adjacent ones
  • 6. Use of the preprocessor programs easier to develop easier to read easier to modify example #include <stdio.h> #define PI 3.1415 int main() { int radius; float area; printf("Enter the radius: "); scanf("%d",&radius); area=PI*radius*radius; printf("Area=%.2f",area); return 0; }
  • 7. #ifdef and #endif in c It only checks identifier has been defied or not. #ifdef <Identifer> ------------- ------------- #else ------------- ------------- #endif Example #include<stdio.h> #define ABC 25 #define PQR "Exact Help" int main(){ int num = 3; #ifdef ABC printf("%d",ABC * ABC); #else printf("%s",PQR); #endif return 0; } Output: 625
  • 8. # error directive in c Syntax : #error it only issue an error message and this error message includes . Example #include<stdio.h> #ifndef __MATH_H #error First include then compile #else int main(){ float a,b=25; a=sqrt(b); printf("%f",a); return 0; } #endif Output: compiler error --> Error directive :First include then compile
  • 10. Want to learn more about programming or Looking to become a good programmer? Are you wasting time on searching so many contents online? Do you want to learn things quickly? Tired of spending huge amount of money to become a Software professional? Do an online course @ baabtra.com We put industry standards to practice. Our structured, activity based courses are so designed to make a quick, good software professional out of anybody who holds a passion for coding.
  • 11. Follow us @ twitter.com/baabtra Like us @ facebook.com/baabtra Subscribe to us @ youtube.com/baabtra Become a follower @ slideshare.net/BaabtraMentoringPartner Connect to us @ in.linkedin.com/in/baabtra Give a feedback @ massbaab.com/baabtra Thanks in advance www.baabtra.com | www.massbaab.com |www.baabte.com
  • 12. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Cafit Square, Hilite Business Park, Near Pantheerankavu, Kozhikode Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com