JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: C Language in hindi

Preprocessor : Compiler Control Directives in hindi कम्पाइलर कण्ट्रोल डायरेक्टिव क्या है c कंप्यूटर भाषा में हिंदी में

कम्पाइलर कण्ट्रोल डायरेक्टिव क्या है c कंप्यूटर भाषा में हिंदी में Preprocessor : Compiler Control Directives in hindi :-

जब किसी large प्रोग्राम को run करते है तभी कुछ प्रॉब्लम आती है :-

1. जब किसी प्रोग्राम मे macro को define किया जाता है|तो ये पता लगाना मुश्किल है की macro define होता है या नहीं |
2.जब कोई यूजर दो अलग अलग कंप्यूटर के लिए प्रोग्राम बनता है तब कुछ lines की जरुरत होती उन प्रोग्राम को दो दो अलग अलग कंप्यूटर मे run करने के लिए|
3.जब हम अलग अलग कस्टमर के लिए प्रोग्राम बनाते है तब केवल एक प्रोग्राम उन दोनों कस्टमर्स  के लिए बनाना पड़ता है |
इन सभी प्रॉब्लम का एक solution होता है अलग अलग प्रोग्राम को develop करना अलग अलग condition के लिए |
या फिर एक प्रोग्रम को develop करना जिसमे कई ऑप्शनल code होगे और किसी condition के फॉलो होंव पर control उए sepcific code पर मूव हो जायेगा |इस प्रोसेस को Compiler Control Directives कहते है |इस प्रोसेस मे lines को switch on और off कर सकते है |
Condition 1
इस प्रकार  मे condition को macro मे define की जाती है |इस condition मे macro हमेशा declare होगा जो की condition expression हो hold करेगा |जैसे
#include “filename “
#ifndef  MACRO_NAME
#define  MACRO_NAME 1
#endif
इस syntax मे, file name उस file का नाम है जिसमे MACRO_NAME की डेफिनिशन होती है |
#ifndef  MACRO_NAME statement से macro_name की definition को file _name मे search होती है |अगर  MACRO_NAME की definition file name मे नहीं होती तब  ‘#ifndef’ और ‘#endif’ के बीच की सभी statements perform होगी |
और अगर MACRO_NAME की definition मिलती है तब macro statement का declartion नहीं होगा |
Condition 2
जब किसी प्रोग्राम को सभी कंप्यूटर के लिए पोर्टेबल बनाने के लिए इस तरह के प्रोग्रामिंग का use करेगे |इअका syntax है :-
main()
{
statement 1;
statement 2;
#ifdef MAC_BOOK
{
statement for portabality;
}
else
{
statement for portablity for Normal HP machine;
}
#endif
staement 3;
statement 4;
}
अगर MAC_BOOK  define होता है complier ,mac book के लिए code को perform करता है |नहीं तो नार्मल HP machine को code perform होता है |
Condition 3.
ये syntax condition 2 की तरह होते है जैसे
main()
{
statement 1;
statement 2;
#ifdef customer 1
{
statement;
}
else
{
code for customer 2;
}
#endif
staement 3;
statement 4;
}
जब customer 1 define होता है तब customer 1 से associate code perform होगा |और नहीं तो customer 2 का code perform होगा |
ANSI Addition :
ANSI addition से C language मे पहले से define preprocessor के आलावा दुसरे preprocessor को add कर सकते है |
1.#elif directive
इस preprocessor से if…else….if sequenceको बनता है |इसका उदाहरन है :-
#if  expression 1
statement1
#elif expression 2
statement 2
……………..
……………..
#elif expression N
statement N
#endif
उदाहरण के लिए :
#if MACHINE==MAC
#define FILE “mac.h”
#elif MACHINE==HP
#define FILE “hp.h”
#elif MACHINE==WIPRO
#define FILE “wipro.h”
#endif
2.#pragma Directive
ये statement implementation oriented directive है जो कई प्रकार के statement कोम्प्लिएर को देता है |जैसे time और space optimization |इसका  syntax है :-
#pragma name;
इसमें name ,pragma का नाम है जिसे यूजर use करना चाहता है |इसका उदाहरण है :-
#pragma loop_optimization(on);
इस statement से किसी loop को optimize करने के लिए  किया जाता है |
3.#error
इस statement का use ,error message को produce करने के लिए किया जाता है |इसका syntax है :-
#error message
ये statement error message produce होता है और प्रोग्रम terminate हो जाता है |
उदाहरण के लिए :
#if !defined(FILE_G)
#error NO GRAPHIC CARD
#endif
4.Stringing operator
इस operator का use ,macro statement मे string को define करने के लिए किया जाता है |इस operator से किसी macro statement के formal  argument को string मे convert कर सकते है |
जैसे
#define sub(ab) printf(#ab ” = %d \n “, ab)
main()
{
……………
……………
sub(a-b);
}
इस article मे हमने Compiler Control Directives और ANSI addition को पढ़ा |age आने वाले article मे macro based example को पढेगे |
Sbistudy

Recent Posts

Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic

Question Tag Definition • A question tag is a small question at the end of a…

2 weeks ago

Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)

Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…

2 weeks ago

Report Writing examples in english grammer How to Write Reports explain Exercise

Report Writing • How to Write Reports • Just as no definite rules can be laid down…

2 weeks ago

Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th

Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…

2 weeks ago

विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features

continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…

2 weeks ago

भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC

भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…

2 weeks ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now