Pointer As Function Argument (Call by Reference) in hindi in c language पॉइंटर फंक्शन आर्गुमेंट की तरह

पॉइंटर फंक्शन आर्गुमेंट की तरह Pointer As Function Argument (Call by Reference) in hindi in c language :-
function मे हमने पढ़ा था की variables को main() function से user define function के लिय दो तरीके होते है |एक call by value और call by reference |
call by value:
इस प्रकार मे variable को function argument मे भेजा  जाता है |इसमें  यूजर define function के द्वारा formal parameter मे हुए changes का effect actual parameter मे नहीं पड़ता है |उदाहरन के लिए :
#include<stdio.h>
#include,conio.h>
int add(int.int);
void main()
{
int a=15,b=23;
add(a,b);        ///call of function by call by value //
getch();
}
void add(int c,int d)  // formal parameter //
{
int sum ;
sum =c+d;
printf(“Output =%d”,sum);
}
इस उदाहरण मे , avariable a और b की value को call function statement add(a,b); मे actual parameter की तरह पास्ड किया गया है |और function definition statement मे formal parameter c और d मे ,वरिअबेल a और b की value सेव होती है |ओत function मे operation perform होती है|call by reference:
जब किसी function के आर्गुमेंट मे variable के address को pass किया जाता है और address को receive करने के लिए pointer को use किया जाता है use method  को call by reference कहते है |इस method मे , function (जिसे called किया जाता है ), calling function के variable की value को change कर सकता है |
उदाहरण के लिए:
#include<conio.n>
#include<stdio.h>
int swap (int * , int *);
void main()
{
int a,b ;
printf(“Enter Data “);
scanf(“%d %d”,&a,&b);
printf(“value of a or b is %d or %d”,a,b);
swap(&a,&b);      // Calling function by reference /address of variable a or b //
printf(“After Swapping”);
printf(“value of a or b is %d or %d”,a,b);
getch(0;
}
void swap (int *c,int *d)
{
int t;
t=*d;
*d=*c;
*c=t;
}
इस उदाहरण मे , user define function मे , कोई भी value return नहीं हो रही है क्योकि इसमें function के आर्गुमेंट मे variable a, b के address को pass किया गया है |और function definition मे pointer varibale c और d मे ,variable a और b के address store हो जाते है |
t=*d; से pointer variable ‘d’ मे store address (variable ‘b’ का address ) पर store value t मे assign हो गयी |
*d=*c; से pointer variable ‘c’ मे store address (variable ‘a’ का address) पर store value ,  pointer variable ‘d’ मे store address (variable ‘b’ का address) पर assign हो जाती है |
*c=t;से pointer variable ‘c’ मे store address (variable ‘a’ का address) मे variable ‘t’ की व;उए store हो जाती है |
inshort , जो भी changes होते है वो variable ‘a’ और ‘b’ की value के साथ होता है |

आउटपुट होगा :
Enter data  12 44
value of a or b is 12 or 44
After Swapping
value of a or b is 44 or 12

Pointer Array as Function Argument 
जब किसी array को function के arguments मे pass किया जाता है तब पुरे array की value function argument pass नही होती है बल्कि array के first element का address function argument मे pass होता है |अतः प्रोग्रामर function definition मे,passed array को receive करने के लिए array  को नहीं ,pointer को use करते है |क्योकि pointer भी array के first element के address को contain करता है |
जैसे
#include<conio.n>
#include<stdio.h>
int print_array (int  , int *);
void main()
{
int a[5],b=5;
printf(“Enter Data “);
scanf(“%d %d”,&a,&b);
for(i=0;i<1;i++)
{
scanf(“%d”,&a[i]);
}
print_array(a , b[]);
getch(0;
}
void  print_array(int c,int *d)
{
for(i=0;i<c;i++)
{
printf(“%d”,*d);
d++;
}
}
इस उदाहरण मे ,array ‘b’  को function print_array () के arguments मे pass किया जाता है |और pointer variable ‘d’ मे receive किया जाता है |


Function Returning Pointer :
C language मे , अगर function मे return statement का use नार्मल variable के साथ हो रहा तो केवल एक ही value return होगी |
लेकिन pointer के साथ ,multiple value को main() function या calling function मे return करा सकता है |
उदाहरण के लिए:
#include<conio.h>
#include<stdio.h>
int *great( int * ,int *);
void main()
{
int a,b;
int *c;
printf(“Data”);
scnaf(“%d %d”,&a,&b);
c=great(&a,&b);
printf(“The greater value is %d”,*c);
getch(0;
}
int *great(int *, int *t)
{
if(*s>*t)
{
return(s);
}
else
{
return(t);
}
}
इस उदहारण मे,function declaration मे int * को use इसलिए किया गया है क्योकि function pointer variable s या t की value को return करता है |

आउटपुट होगा :
data 12 45
The greater value is 45

ये ध्यान रखना है की हमेशा return statement मे pointer variable का address return होगा |और printf(“The greater value is %d”,*c); मे ‘*c’ को use किया गया है | greater value को print करने के  लिए|