JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

User Define Function : Nesting or Array in hindi in c language नेस्टिंग या अरे इन c कंप्यूटर भाषा

नेस्टिंग या अरे इन c कंप्यूटर भाषा User Define Function : Nesting or Array in hindi in c language :-
Function के classification मे हमने चार प्रकार के functions (No Arguments or No return values, Arguments bur no return vaue,Arguments with return value और no arguments with return value ) को पढ़ा है |

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 :

C language मे, array को function मे pass कर सकते है |array तीन प्रकार की होती है :इसलिए इसे हम तीन headings मे पड़ेगे|
1.One dimensional array :
जब किसी One dimensional array को function मे pass करते tab केवल array name को subscript के बिना ही calling statement मे pass कर देते है |इसका syntax है :
function calling: function name ( array_name, int size );
function declaration : function type (array _ name declare [], int size_variable);
उदहारण के लिए :
#include<stdio.h>
#include<conio.h>
int max(int a[],int size);
void main()
{
int a[5]={12,23,21,45,34};
int m;
m=max (a,5);
printf(“Maximum number is %d”,m);
getch ();
}
int max (int a [],int size)
{
int max=0;
for(int i=0;i<=size;i++)
{
if(max<a[i])
{
max=a[i];
}
return(max);
}
इस उदाहरण मे ,array [5] को कालिंग function statement m=max (a,5); मे pass किया गया है |इस statement मे ‘a’ array का नाम है और 5 array की size  है |
आउटपुट होगा :

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 की तरह होता है |

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

#include<stdio.h>
#include<conio.h>
#define row 2
#define colunm 2
int add(int a[][colunm],int  b[][colunm]);
void main()
{
int a[row][colunm]={12,23;
                                 11,34 };
int b[row][colunm]={16,24;
                                  17,36 };
add(a,b);
getch ();
}
int max (int a [][],row,colunm,b[][],row,colunm)
{
int i,j;
int c[row][colunm];
for(i=0;i<row;i++)
{
for(j=0;j<colunm;j++)
{
c[i][j]=a[i][j]+b[i][j];
printf(“%d \t”,c[i][j]);
}
printf(“\n”);
}

आउटपुट होगा :
28   47
28   70

Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

21 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

21 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

3 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

3 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

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 ,…

3 months 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