Monday, April 20, 2015

सी (प्रोग्रामिंग भाषा) सम्पादन (अनुभाग)

== प्रोग्राम लिखने की विधि ==
’सी’ प्रोग्रामिंग भाषा मे किसी भी प्रोग्राम का निष्पादन (<tt>execution</tt>) करने के लिये हमे एक <tt>'''main()'''</tt> फंक्शन अवश्य लिखना होता है। क्योंकि ’सी’ कम्पाइलर किसी भी प्रोग्राम को निष्पादित करना <tt>main()</tt> फंक्शन से आरंभ करता है। एक [[संगणक संचिका|संचिका]] अथवा एक प्रोग्राम मे एक से अधिक <tt>main()</tt> फंक्शन नही हो सकते।<br />
<pre>
main()
{
.........
.........
}
</pre>
यह एक प्रयोगकर्ता द्वारा परिभाषित फंक्शन है। ''main()'' फंक्शन को '''’{’''' कोष्ठक द्वारा आरंभ किया जाता है। प्रोग्राम [[संगणक संचिका|संचिका]] के निष्पादन के समय ’{’ यह बताता है कि निष्पादन यहाँ से आरंभ करना है। इसी प्रकार '''’}’''' यह बताता है कि निष्पादन यहाँ समाप्त होना है। एक प्रोग्राम मे ''main()'' फंक्शन तो एक ही रहता है परन्तु अन्य फंक्शन का प्रयोग किया जा सकता है। प्रत्येक फंक्शन के लिये '''{''' और '''}'''
के मध्य उपप्रोग्राम दिया जाता है। प्रत्येक निर्देश का अन्त सेमीकालन '''’;’''' द्वारा होना आवश्यक है।<br />

; सी-प्रोग्राम का एक उदाहरणः
<pre>
main()
{
printf("/nMY NAME IS......./n");
}
</pre>इस प्रोग्राम को चलाने पर इसका आउटपुट निम्नवत होगा: <br />

एक अन्य उदाहरण
{|border="0" cellpadding="0" cellspacing="1em"
|<source lang="c">
//second program in c
#include<stdio.h>
#include<conio.h>
main(){
  int i,j;
  {
    printf("enter the value of i");
    scanf("%d",&i);
    printf("enter the value of j");
    scanf("%d",&j);
  }
  getch();
}
/*and the output of this program
enter the value of i=4;
enter the value of j=5;
</source>
|}

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

© 2013 ONLINE INDIA. All rights resevered. Designed by Templateism