JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: C Language in hindi

what is User Define Function : Importance or Definition in hindi in c language कंप्यूटर भाषा

कंप्यूटर भाषा में यूजर डिफाइन फंक्शन क्या है , what is User Define Function : Importance or Definition in hindi in c language :-
function,C language का powerful toll है क्योकि इसे declare और use करना सरल है |किसी C प्रोग्राम मे main(),printf() और scanf() मुख्य functions है |इस article मे :
1. Function कैसे design होता है ?
2. Function को कैसे प्रोग्रम से लिंक करते है ?
3. दो या दो अधिक functions को कैसे जोड़े ?
4. ये functions कैसे data transfer करते है ?C function दो प्रकार से classified किया गया है :-
Library Function : ये Pre Define function होता है ये header file मे store होता है |इसे किसी प्रोग्रम मे  function calling करके use कर सकते है |जैसे :
math.h : cosh (x),pow((x,y) आदि |
stdio.h : printf() ,scanf() आदि |
string.h : strstr(),strlen() आदि |
User Define Function : ये यूजर define होगा |जैसे :
main () function.

Main():

Main () ये indicate है प्रोग्राम का starting point जहा  से प्रोग्राम execute होगा |किसी भी code को सिर्फ main() function से execute कर सकते है लेकिन  main() की length बड़ी और complex होगी तबdebugging ,running और testing मे difficulty होती है |Function मे अलग अलग parts होते है जो अलग अलग  execute होते है बाद मे combine होते है |
User Define Function की Need :
1. इसमें प्रोग्राम subprogram मे डिवाइड हो जाता है इसलिए time complexity कम हो जाती है |
2.किसी specific functions को repeat करना easy हो जाता है |

C Program का Approach :
जब किसी C प्रोग्राम मे दो या दो से अधिक functions होते  है तब्ब प्रोग्राम दो प्रकार से RUN होता है :-
1.Top-Down Prograameing 
इस प्रोग्रामिंग स्टाइल मे , complex और high level code पहले solve होते है और lower level function की डिटेल्स को बाद मे address किया जाता है |
इस स्टाइल मे , long प्रोग्राम की length को function से कम कर सकते है |लेकिन माइक्रो कंप्यूटर के लिए ये fact फिट नहीं होता है क्योकि माइक्रो कंप्यूटर मे space redution main होती है |
इस स्टाइल  मे faulty function को easily find किया जा सकता है |
उदहारण के लिए :
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b.c;
printf(” Enter two values “);
scanf(“%d %d”,&a,&b);
c=add(a,b);
printf(“Add =%d”,c);
getch();
}
int main( int r,int f)
{
int sum;
sum=r+f;
return sum;
}
इस प्रोग्राम मे main function को पहले declare किया गया है और main() function ही पहले execute होगा |
add() function बाद मे होगा |

Bottom -Up Style :
ये स्टाइल high level कंप्यूटर languages(c++,JAVA आदि ) मे use होती है |इसमें subprograme पहले design होते है बाद मे main(0 function का exucation होता है |
#include<stdio.h>
#include<conio.h>
int main( int r,int f)
{
int sum;
sum=r+f;
return sum;
}
void main()
{
int a,b.c;
printf(” Enter two values “);
scanf(“%d %d”,&a,&b);
c=add(a,b);
printf(“Add =%d”,c);
getch();
}

इस प्रोग्राम मे add() function main() function से पहले execute होगा |

Function Definition :
User Define Function बनाने के लिए , तीन प्रकार operation मुख्य होते है :-
1.Function Defination
Function को define करने से मतलब है function के लॉजिक को syntax मे व्यस्थित करना है |कभी कभी इसे function implementation भी कहते है |इसके सात भाग मुख्य होते है |ये सात भाग भी two group मे डिवाइड होते है |
1. function Header
2. function Body

function header मे function name,function type और parameter list आते है |
1. function Name और Type :
Function Type ये define करता है function के आउटपुट का datatype कोनसा होगा जो main function मे return होगा |
function name उस function का नाम, होता है जो C language के rules को फॉलो करना कहिये जैसे duplication नहीं होना चाहिए |
जब कोई function कोई value return नहीं करता तब उसका type void होता है जिसका मतलब है No Return Values |

2Function Parameter
इसे formal parameter भी कहते है |इस variables मे ,function calling के समय जो variable pass किये गये होगे use assign करता है |इसके बारे मे हम आगे के article मे पढ़गे |
सभी variables को comma से deferential करते है |अगर कोई भी variable pass नहीं होता तब void लिखना जरुरी होता है |

Function Body :
ये सभी executable statements और declaration को रखता है ये {} से क्लोज होता है इसके तीन parts होते है :
Variable Declaration : इसमें सभी local variable को declare किया जाता है ज्जिन्हे केवल उसी function मे use कर सकते है |
Function Statements : इसमें सभी statements को लिखा जाता है |
Return : इसमें function के लॉजिक से मिला आउटपुट को return किया जाता है जिसे main() मे use किया जाता है |

Return Statement को हम age article मे पड़ेगे |

उदहारण के लिए :

int add (int c,int d)  // function type:int,function name: add , Paratmeter: int a,int b//
{                              // Function body start //

int sum ;                // local variable declaration //

sum=a+b;             // Statement//

return sum;          //  return statement//

}                           // function Body close//

इस function का datatype int है क्योकि sum का datatype integer है जो की main()  फ़ुन्क्तिओन्न मे return हो रही है |

function,C language का powerful toll है क्योकि इसे declare और use करना सरल है |किसी C प्रोग्राम मे main(),printf() और scanf() मुख्य functions है |इस article मे :
1. Function कैसे design होता है ?
2. Function को कैसे प्रोग्रम से लिंक करते है ?
3. दो या दो अधिक functions को कैसे जोड़े ?
4. ये functions कैसे data transfer करते है ?

C function दो प्रकार से classified किया गया है :-
Library Function : ये Pre Define function होता है ये header file मे store होता है |इसे किसी प्रोग्रम मे  function calling करके use कर सकते है |जैसे :
math.h : cosh (x),pow((x,y) आदि |
stdio.h : printf() ,scanf() आदि |
string.h : strstr(),strlen() आदि |
User Define Function : ये यूजर define होगा |जैसे :
main () function.


Main():


Main () ये indicate है प्रोग्राम का starting point जहा  से प्रोग्राम execute होगा |किसी भी code को सिर्फ main() function से execute कर सकते है लेकिन  main() की length बड़ी और complex होगी तबdebugging ,running और testing मे difficulty होती है |Function मे अलग अलग parts होते है जो अलग अलग  execute होते है बाद मे combine होते है |


User Define Function की Need :
1. इसमें प्रोग्राम subprogram मे डिवाइड हो जाता है इसलिए time complexity कम हो जाती है |
2.किसी specific functions को repeat करना easy हो जाता है |

C Program का Approach :
जब किसी C प्रोग्राम मे दो या दो से अधिक functions होते  है तब्ब प्रोग्राम दो प्रकार से RUN होता है :-
1.Top-Down Prograameing 
इस प्रोग्रामिंग स्टाइल मे , complex और high level code पहले solve होते है और lower level function की डिटेल्स को बाद मे address किया जाता है |
इस स्टाइल मे , long प्रोग्राम की length को function से कम कर सकते है |लेकिन माइक्रो कंप्यूटर के लिए ये fact फिट नहीं होता है क्योकि माइक्रो कंप्यूटर मे space redution main होती है |
इस स्टाइल  मे faulty function को easily find किया जा सकता है |
उदहारण के लिए :
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b.c;
printf(” Enter two values “);
scanf(“%d %d”,&a,&b);
c=add(a,b);
printf(“Add =%d”,c);
getch();
}
int main( int r,int f)
{
int sum;
sum=r+f;
return sum;
}
इस प्रोग्राम मे main function को पहले declare किया गया है और main() function ही पहले execute होगा |
add() function बाद मे होगा |

Bottom -Up Style :
ये स्टाइल high level कंप्यूटर languages(c++,JAVA आदि ) मे use होती है |इसमें subprograme पहले design होते है बाद मे main(0 function का exucation होता है |
#include<stdio.h>
#include<conio.h>
int main( int r,int f)
{
int sum;
sum=r+f;
return sum;
}
void main()
{
int a,b.c;
printf(” Enter two values “);
scanf(“%d %d”,&a,&b);
c=add(a,b);
printf(“Add =%d”,c);
getch();
}

इस प्रोग्राम मे add() function main() function से पहले execute होगा |

Function Definition :
User Define Function बनाने के लिए , तीन प्रकार operation मुख्य होते है :-
1.Function Defination
Function को define करने से मतलब है function के लॉजिक को syntax मे व्यस्थित करना है |कभी कभी इसे function implementation भी कहते है |इसके सात भाग मुख्य होते है |ये सात भाग भी two group मे डिवाइड होते है |
1. function Header
2. function Body

function header मे function name,function type और parameter list आते है |
1. function Name और Type :
Function Type ये define करता है function के आउटपुट का datatype कोनसा होगा जो main function मे return होगा |
function name उस function का नाम, होता है जो C language के rules को फॉलो करना कहिये जैसे duplication नहीं होना चाहिए |
जब कोई function कोई value return नहीं करता तब उसका type void होता है जिसका मतलब है No Return Values |

2Function Parameter
इसे formal parameter भी कहते है |इस variables मे ,function calling के समय जो variable pass किये गये होगे use assign करता है |इसके बारे मे हम आगे के article मे पढ़गे |
सभी variables को comma से deferential करते है |अगर कोई भी variable pass नहीं होता तब void लिखना जरुरी होता है |

Function Body :
ये सभी executable statements और declaration को रखता है ये {} से क्लोज होता है इसके तीन parts होते है :
Variable Declaration : इसमें सभी local variable को declare किया जाता है ज्जिन्हे केवल उसी function मे use कर सकते है |
Function Statements : इसमें सभी statements को लिखा जाता है |
Return : इसमें function के लॉजिक से मिला आउटपुट को return किया जाता है जिसे main() मे use किया जाता है |

Return Statement को हम age article मे पड़ेगे |

उदहारण के लिए :

int add (int c,int d)  // function type:int,function name: add , Paratmeter: int a,int b//
{                              // Function body start //

int sum ;                // local variable declaration //

sum=a+b;             // Statement//

return sum;          //  return statement//

}                           // function Body close//

इस function का datatype int है क्योकि sum का datatype integer है जो की main()  फ़ुन्क्तिओन्न मे return हो रही है |

Sbistudy

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…

2 weeks ago

Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)

Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…

2 weeks ago

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…

2 weeks ago

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…

2 weeks ago

विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features

continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…

2 weeks ago

भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC

भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…

2 weeks ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now