हिंदी माध्यम नोट्स
User Define Function : Return Type or Basic Examples in hindi यूजर डिफाइन फंक्शन हिंदी में
Function difination मे return statement का अलग से महत्व है |return statement से user define function से केवल एकक value को main function मे transfer कर सकते है |इसका syntax है :-
return(); और return(expression);
return statement दो प्रकार के होते है :-
Plain Return Statement :
return() को Plain Return Statement कहते है |ये statement main() function मे कोई value pass नहीं करता है |इसका मतलब है की function पूरा हो चूका है |जब भी Plain Return Statement आ जाता है उसके बाद COMPILER का control main function मे चला जाता है |
उदहारण के लिए :
#include<stdio.h.
#include<conio.h.
void large(int,int);
void main()
{
int a,b;
printf(“Enter your data”);
scanf(“%d %d”,&a,&b);
large(a,b);
printf(“End of This Program”);
getch();
}
int large (int c, int d)
{
if(c<d)
{
printf(“%d is less than %d. “,c,d);
return();
}
else
{
printf(“%d is less than %d. “,d,c);
return();
}
}
इस उदाहरण मे , function large() मे जब condition (c<d) true होगा तब printf(“%d is less than %d “,c,d); execute होगा और complier का control main() function मे मूव हो जाता है |और printf(“End of This Program”); execute होता है |
आउटपुट होगा :
Enter your data 34 45
34 is less than 45.
End of This Program
Return(expression);
इस statement से किसी expression के आउटपुट को main() function मे pass होता है |उदाहरण के लिए:
#include<stdio.h>
#include<conio.h.
float power(int,int);
void main()
{
int a,b,c,d;
printf(“Enter your data”);
scanf(“%d %d”,&a &b);
d=c+power(a,b);
printf(“Expression Output=%d”,)
Return statement मे constant value को भी पास कर सकते है |Return statement का default data type integer होता है |जब प्रोग्रामर किसी विशेष data type को pass करना चाहता है तब use function definition के header portion मे function type को change करना पड़ेगा |उदाहरण के लिए :
#include<stdio.h>
#include<conio.h>
void large(int,int);
void main()
{
int a,b,i;
printf(“Enter your data”);
scanf(“%d %d”,&a,&b);
i=large(a,b);
if(i==1
{
printf(“%d is less than %d. “,a,b);
}
else
{
printf(“%d is less than %d. “,b,a);
getch();
}
int large (int c, int d)
{
if(c<d)
{
return(1);
}
else
{
return(0);
}
}
इस उदाहरण मे , जब condition true होगी तब ‘1’ pass होगा और false होने पर ‘0’ pass होगा |
आउटपुट होगा :
Enter your data 56 76
56 is less than 76.
Calculate Simple Interest */
int P,R,T;
Principal”);
“,&P);
Rate”);
“,&R);
Time”);
“,&T);
You!”)
c)
Intrest Is %f”,s);
For Calculate Area of Circle */
int radius;
radius”);
“,&radius);
%2f”,area);
You!”)
For find a number और not */
int number;
Number”);
“,&number);
printf(“Number is Even.”)
return();
printf(“Number is not Even.”)
return();
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…
Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)
Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…
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…
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…
विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features
continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…
भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…