Why do we need to write include<stdio.h> :-
In C programming Language, #include<stdio.h> is a statement जो compiler को विशेष स्थान पर stdio के contents डालने के लिए कहता है।
यहां, "#" एक Preprocessor है जिसका अर्थ है कि इसमें Code compile करने से पहले header फ़ाइल शामिल करना.
header file को compiler से कनेक्ट करने के लिए "include" कमांड देता है और "stdio" का अर्थ "standard input output" है। चूंकि यह एक हेडर फाइल है इसलिए '.h' एक्सटेंशन है। इसमें कुछ मानक इनपुट/आउटपुट फ़ंक्शंस जैसे "प्रिंटफ" और "स्कैनफ" शामिल हैं।
'C' programming language में सभी library functions को ".h" एक्सटेंशन के साथ विभिन्न श्रेणियों में अलग-अलग हेडर फाइलों में शामिल किया गया है और इन functions को programmer द्वारा परिभाषित नहीं किया गया है। ये फ़ंक्शन पहले से ही language library के अंदर परिभाषित हैं। इस प्रकार के predefined functions का उपयोग करने के लिए, हमें संबंधित header file को शामिल करना होगा।
C programming language में, printf() फ़ंक्शन का उपयोग आउटपुट स्क्रीन पर "character, string, float, integer, octal and hexadecimal values" को प्रिंट करने के लिए किया जाता है और scanf() फ़ंक्शन का उपयोग character, string, numeric, कीबोर्ड से डेटा पढ़ने के लिए किया जाता है।
जैसा कि आप जानते हैं, printf() एक standard output function है और scanf() एक standard input function है, इसलिए प्रोग्राम में printf() और scanf() का उपयोग करने के लिए, हमें #include<stdio.h> लिखना होगा।
चलिये अभी एक प्रोग्रम कि म्द्द्द से इसे सम्झ्ते है.
#include<stdio.h>
int main()
{
int number;
printf("Type any number:");
scanf("%d",&number);
printf("square that number is:%d ",number*number);
return 0;
}
Output :-
Type any number : 3
Square that number is 9
Note:
scanf ("% d", &number) statement कंसोल से integer संख्या पढ़ता है और दिए गए value को number variable में संग्रहीत करता है।
printf("Square that number :% d", number*number) statement कंसोल पर number के square को प्रिंट करता है।
Explaining Concept of Blocks in C
C एक block structure भाषा है। इसमें एक प्रोग्राम हेडर होता है जिसके बाद एक ब्लॉक होता है। एक ब्लॉक को declarations के sequence के रूप में परिभाषित किया जाता है, इसके बाद शुरुआत और अंत में संलग्न statements का एक सेट होता है। C प्रोग्रामिंग भाषा में, curly braces '{' की एक जोड़ी का उपयोग करके एक ब्लॉक बनाया जाता है और end को एक क्लोजिंग कर्ली ब्रेस '}' द्वारा दर्शाया जाता है।
प्रत्येक C प्रोग्राम में ब्रेसिज़ ({ }) महत्वपूर्ण हैं। प्रत्येक C प्रोग्राम में ऐसे statements होते हैं जो curly braces ({ }) में संलग्न होते हैं। C में opening brace ({) और closing brace ( } ) का उपयोग किया जाता है। दोcurly braces के बीच प्रोग्रामर को declaration and executable part declare करना चाहिए। curly braces का opening , function की शुरुआत या main function की परिभाषा की शुरुआत को specify करता है और closing brace main function के लिए प्रोग्राम code के अंत को specify करता है। curly braces के भीतर दिए गए statements , function के आवश्यक task को पूरा करते हैं।
एक block-structured भाषा का उपयोग करने का main idea is the easiness with which a program can be written and to realize a complex program in a modular form. एक modular program एक भाषा style का एक systematic development है जिसमें एक मुख्य भाग होता है जिसमें विभिन्न functions और function calls होते हैं।



0 Comments