Skip to main content

PREPROCESSOR

C PROGRAMMING CONTAINS VARIOUS ELEMENTS LIKE PREPROCESSOR DIRECTIVES , FUNCTIONS , DATA TYPES , OPERATORS , ETC .

WE SHALL DISCUSS HERE ABOUT ALL THE THINGS WHICH ARE RELATED TO C PROGRAMMING ONE BY ONE .

IN THIS POST  WE DISCUSS ABOUT PREPROCESSOR.


  • WHAT IS PREPROCESSOR ?


AS ITS NAME IMPLIES , THE PROCESSOR WHICH ARE DEFINE BEFORE THE COMPILATION OF SOURCE CODE(PROGRAM) IS CALLED PREPROCESSOR . IN SIMPLE LANGUAGE ,  THOSE FUCNTIONS WHOSE MEANING HAD ALREADY DEFINED IN PROGRAMME BEFORE THE COMPILATION .

for example:- #include<stdio.h>
                               #include<conio.h>
                               #define   etc

NOTE:-  printf() and scanf() functions are the functions of #include<stdio.h>
               clrscr() and getch() functions are the functions of #include<conio.h>


  1. PREPROCESSOR DIRECTIVES:-
                                                                   PREPROCESSOR DIRECTIVES FOLLOW SPECIAL SYNTAX THAT ARE BEGIN WITH THE SPECIAL SYMBOL (#) AT THE END.

THESE DIRECTIVES CAN BE DEVIDED INTO THREE CATEGORIES:-

  • MACRO SUBSTITUTION DIRECTIVES
  • FILE INCLUSION DIRECTIVES
  • COMPILER CONTROL PROGRAMME

a.)MACRO SUBSTITUTION DIRECTIVES:-
                                                                       MACRO SUBSTITUTION IS A PROCESS WHERE AN IDENTIFIER IN A PROGRAM IS REPLACED BY PREDEFINED STRING WITH #define STATEMENT .

a.) SIMPLE MACRO SUBSTITUTION:- 
                                                                    SIMPLE STRING REPLACEMENT IS USED TO DEFINE CONSTANT . ALL MACRO IDENTIFIERS ARE IN CAPITAL LETTERS .

for example:- #define PI 3.14
                      #define count 100

b.) MACRO WITH ARGUMENT:-
                                           #define CUBE(x) (x*x*x)

c.) NESTING MACRO:-
                  #define M 5 
                  # define N M+1

2. FILE INCLUSION:-
                                     #include<stdio.h>
                                     #include"stdio.h"

WHEN THE FILE NAME IS INCLUDED WITHIN THE DOUBLE QUOTATION("") , THE SEARCH FOR THE FILE IS MADE FIRST IN THE CURRENT DIRECTORY AND THEN IN THE STANDARD DIRECTORIES .

3. CONDITIONAL COMPILATION:- 
                                                               C PREPROCESSOR PROVIDED THE FACILITIES OF CONDITIONAL COMPILATION . CONDITIONAL COMPILATION ALLOWS YOU TO CONTROL THE   COMPILATION PROCESS BY INCLUDING #if  COMMAND  IN THE PROGRAM .

for example:-    #if expression 
                             code to be included , if expression is true ,
                         # else
                            code to be included , if expression is false .
                         #end if .         

"WE SHALL DISCUSS THE OTHER PARTS OF C PROGRAM IN DETAIL IN OUR NEXT POST" .

NOTE:- IF YOU HAVE ANY CONFUSION RELATED TO THIS TOPIC , YOU CAN ASK ME ON COMMENT SECTION.😊
---------------------------------------------------------------------------------------------------------------------------
for more knowledge:-




Comments

Popular posts from this blog

BEST GAMING LAPTOPS FOR HIGH QUALITY/GRAPHICS GAMES

THE BEST GAMING LAPTOPS  NOW-A-DAYS THE TREND OF VIDEO GAMES HAS INCREASED. NEW GENERATION IS ENJOYING VIDEO GAMES VERY MUCH NOW-A-DAYS . MOST OF THE LATEST GAMES ARE COMING UP NOWDAYS WHICH ARE NOT ONLY APPEALING TO CHILDREN BUT  ALSO THE BIG ONES . AND NOWDAYS, GAMES THAT ARE BEING MADE A VERY HIGH QUALITY AND HIGH GRAPHICS IF YOU PLAY SUCH HIGH GRAPHICS GAMES IN A NORMAL LAPTOP THEN THE LAPTOP WILL TURN SLOWER AND HANG IT . THAT'S WHY THERE ARE DIFFERENT GAMING LAPTOPS   COMING FROM SUCH HIGH QUALITY GAMES THAT MUST BE READ BELOW . THE BEST GAMING LA PTO PS ARE FAST CHANGING IN 2019. NOW THAT THE  NEW 20-SERIES GPUs HAVE ST ARTED TO  FILTER INTO OUR FAVOURITE GAMING LAPTOPS MODEL , THE BALANCE OF WHICH ONE IS TRULY   'BEST' IS SHIFTING. WHILE, DOUBT THE BEST GAMING LAPTOP OF LAST YEAR WAS THE MSI GS65 STEALTH THIN , THAT SIMPLY ISN'T IN THE CASE AS WE GET MID-WAY THROUGH 2019. NOW, OUR BEST GAMING LAPTOP IS THE  RAZER BLADE...

How to Make a Bootable Pen drive: A Step-by-Step Guide

  How to Make a Bootable Pen drive: A Step-by-Step Guide   Introduction: In today's digital world, bootable pen drives have become indispensable tools for installing operating systems, running diagnostics, and recovering data. Creating a bootable pen drive is easier than you might think, and this guide will walk you through the process in a simple and straightforward manner. Whether you're a beginner or an experienced computer user, this step-by-step tutorial will help you create your own bootable pen drive effortlessly. Step 1 : Gather the Required Materials To make a bootable pen drive, you'll need the following items: 1. A USB pen drive with sufficient storage capacity (at least 8GB is recommended). 2. The ISO file or installation media of the operating system or tool you want to make bootable (e.g., Windows, Linux, etc.). 3. A computer with an available USB port. Step 2: Download the Required Software To create a bootable pen drive, you'll need specialized software...

Top 6 Best Video Games for 2GB RAM Laptops

Top 6 Best Video Games for 2GB RAM: Game Configurations and Recommended Laptops Introduction: When it comes to gaming, having a high-end gaming rig is often considered essential. However, not everyone has access to a powerful computer with loads of RAM and a dedicated graphics card. But fear not, as there are still plenty of enjoyable gaming experiences available for those with more modest hardware configurations. In this blog post, we will explore the top six best video games that can run smoothly on a system with 2GB RAM. Additionally, we will suggest some good laptops that are suitable for gaming on such specifications. 1. Star dew Valley: - RAM Requirement: 2GB - CPU: 2.00 GHz processor - GPU: Integrated graphics with 256MB video memory Star dew Valley is a relaxing farming simulation game that has captivated players with its charming visuals and engaging gameplay. With its low system requirements, it can run smoothly on systems with 2GB RAM. Download Here:  Star dew valley 2....