what is the difference between call by value and call by
reference?

Answer Posted / mahesh

call by value
int fun(int a,int b);
int fun(int p,int q)
{
temp=p;
p=q;
q=temp;
}
call by reference
int fun(int &a,int &b);
int fun(int *a,int *b)
{
temp=*a;
*a=*b;
*b=temp;
}
call by value is with values n call by ref with adresses n
pointers...

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the function of multilevel pointer in c?

672


what is ur strangth & weekness

1824


Explain can static variables be declared in a header file?

684


Write a code to remove duplicates in a string.

633


What is the role of && operator in a program code?

572






Is using exit() the same as using return?

682


How does sizeof know array size?

634


What is new line escape sequence?

814


What is indirection? How many levels of pointers can you have?

663


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

1906


what are the 10 different models of writing an addition program in C language?

1443


Explain can you assign a different address to an array tag?

648


What is auto keyword in c?

792


Is it possible to pass an entire structure to functions?

563


With the help of using classes, write a program to add two numbers.

622