हिंदी माध्यम नोट्स
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
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…