hello world program in c-hello world प्रोग्राम c क्या है?

हेल्लो दोस्तों आज के इस पोस्ट में आपको hello world program in c के बारे में बताया जा रहा है की क्या होता है कैसे काम करता है तो चलिए शुरू करते है

C program development life cycle का परिचय

C में कोई भी program को क्रिएट करने के लिए 4 steps हो सकते है ये steps एक particular order में होते है और इनका अपना कुछ महत्त्व होता है तो आएये पीला c program को क्रिएट करने से पहले इस प्रोसेस को समझने का प्रयास करते है

C program development life cycle

first c program
  1. सबसे पहले आप एक program को लिखने है इसे program में development life cycle की editing part भी कहते है ये program human को readable फॉर्मेट में होता है
  2. इसके बाद आप program को compile करते है तो ये development life cycle का second step होता है इस part में सभी blugs को remove करके program को बाइनरी फॉर्मेट में convert किया जाता है ताकि कंप्यूटर इसे प्रोसेस कर सके
  3. इसके बाद linking प्रोसेस आती है जिसमे इस प्रोसेस में program को necessary लाइब्रेरीज के साथ लिंक किया जाता है जैसे की आपको पता है की c का बेसिक program भी बिना लाइब्रेरी को include किय नही execute हो सकता है libraries c program को execute होने के लिए environment को प्रोविडे करती है
  4. इसके बाद executable file produce कर दी जाती है जिसे आप  जितनी बार चाहे execute कर सकते है editing प्रोसेस का output .c सोर्स file होती है compiling प्रोसेस का इनपुट सोर्स file होती है और output .obj files की होती है linking प्रोसेस का इनपुट .obj file होती है और output .exe file की होती है

structure of a C program

c program structure

pre-processor directives

Global declarations
main()
{
  variables;
  other statements;
}
Otherfunction
{
   variables;
   other statements;
}

your first c program

#include<stdio.h>
int main()
{
   printf(“hello readers!”);
   return();
}

उपर दिए गए program में इसका output आपको निचे दिया जा रहा है

hello readers!

सबसे पहली line में <stdio.h> में header file को program में include किया गया है ये एक standard input/output header file होते है जो program में इनपुट और output को हैंडल करती है इन्हे pre processor directives भी कहते है

इसके बाद main() method को start किया गया है की main method से ही program का execution start होती है इसी method में सभी instructions लिखे जाते है main method का start और end को हम curly brackets के द्वारा दिखाया जाता है इन curly brackets के भीतर के सभी instructions को execute किये जाते है

main function को int type के साथ डिफाइन किया गया है की ये एक standard है और int type के बारे में आप आगे की पोस्ट में बताया जायेगा

main function को एक integer value को return करनी होती है यदि आप program में main() function से कोई value को return नहीं करते है तो program के आखिर में return 0 से स्टेटमेंट को डिफाइन करते है

Commenting

comments आपके program में वह text होता है जिसे compiler उसे ignore कर देता है ये text बाकी statements की तरह ही execute नहीं होताहै

comments program में किसी भी statement को या फिर program को डिफाइन करने के लिए प्रयोग किये जाते है

c language में commenting की general form आपको निचे दिया जा रहा है

/*your comment text here*/

तो आएये अब comments का प्रयोग को एक example से समझने का प्रयास करते है

/*this is a c program which shows hello world message on execution*/
#include<stdio.h>
Int main() /*main function starts form here*/
{
   Printf(“hello world!”); /*this statement will print hello world message*/
   Return 0;
}

जैसे की आप उपर दिए गए program को देख सकते है की comments के माध्यम से program और दुसरे statement के बारे में explanation दी गयी है ये program आपको निचे इसका output दिया जा रहा है

hello world!
hello world program in c

reference-https://www.tutorialspoint.com/learn_c_by_examples/hello_world_program_in_c.htm

निवेदन:-आप सभी छात्र –छात्रों से निवेदन है की अगर आपको ये Topic(hello world program in c) अच्छा लगा हो तो कृपया आप इस वेबसाइट के बारे में अपने दोस्तों को जरुर बताये अगर कोई topic से संबधित प्रश्न हो तो कमेंट्स(comments) आपके लिए ही बना है और किसी Subject के लेकर भी कोई प्रश्न हो तो कमेंट करे

Leave a Comment