हिंदी माध्यम नोट्स
User Define Function : Nesting or Array in hindi in c language नेस्टिंग या अरे इन c कंप्यूटर भाषा
Function with more than one return
इससे पहले हमने पड़ा था की return statement से किसी एक value को return करा सकता है |लेकिन जब programmer को more than two data values को return करना होता है तब इस function को use कर सकते है |
इसमें function को call करते समय actual parameter मे किसी आउटपुट variables के अद्द्द्रेस को formal parameter मे pass करते है | इन address पर data values सेव हो जाती है जो main() function मे use कर सकते है |
उदहारण के लिए :
#include<stdio.h>
#include<conio.h.
int calculation(int a,int b,int*c,int*d)
void main()
{
int a =23,b=12,c,d;
calculation(a,b,&c,&d);
printf(“Addition of Numbers=%d\n”,c);
printf(“Multiplication of Numbers=%d”,d);
getch();
}
int(int e,intf,int*sum,int*mul)
{
sum=e+f;
mul=e*f;
}
int*sum एक pointer है जो की variable c के address को होल्ड कर रहा है |
sum=e+f; statement मे e+f; का जो आउटपुट होगा वो sum address पर store हो जायेगा inshort c के address पर store हो जायेगा |ये पूरा process mul और variable d के साथ भी होगा |
calling function calculation(a,b,&c,&d); मे variable c और d के address PASSED होगा |
आउटपुट होगा :
Addition of Numbers=35
Multiplication of Numbers=276
Nesting of function :
C language function of function को allow करता है जैसे main() function , function 1() को call करता है function 1() ,function 2() को call करता ही function 3() ,function 4() को call करता है |C language मे function की nesting की कोई limit नहीं होती है |
उदहारण के लिए:
#include<stdio.h>
#include<conio.h.
int calculation(int a,int b)
int mul( int, int );
void main()
{
int a =23,b=12,c,d;
c=calculation(a,b);
printf(“Output of Numbers=%d\n”,c);
getch();
}
int(int e,int f )
{
int sum ;
sum=e+mul(e,f);
return sum;
}
int mul( int i,int j )
{
int g;
g=i*j;
}
इस प्रोग्राम मे तीन function है main() ,add() और mul() |main() function , add() को call करता है और add() function , mul() को call करता है |जब sum =e+mul(e,f) execute होता है तब mul() function की return value का addition ,e होता है |
आउटपुट होगा :
Output of Numbers=299]
Array Passing in function :
int a[5]={12,23,21,45,34};
int max (int a [],int size)
max=a[i];
Maximum number is 45
अगर user define function मे array की value मे कोई change होगा तब वे change main array मे होता है |जब पूरी array as formal arguments pass होती है तब उसके values pass नहीं होती |उन values के address pass होती है |
Two -Dimensional Array :
जब किसी Two -Dimensional Array को function arguments मे pass किया जाता है tab ये syntax को फॉलो करना पड़ता है |
function calling मे, केवल array का नाम से call किया जाता है |
syntax : function name (array _name) ;
function definition मे , array को दो brackets के साथ बताया जाता है और second subscript की value को लिखा जाता है |
syntax : function type function_name (int array_name[ ][size],int row size,int column size);
Function header का syntax one dimension array की तरह होता है |
उदहारण के लिए:
int a[row][colunm]={12,23;
int max (int a [][],row,colunm,b[][],row,colunm)
आउटपुट होगा :
28 47
28 70
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
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…