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 pointer and structure in c?

568


praagnovation

1774


What does the message "automatic aggregate intialization is an ansi feature" mean?

689


How can you return multiple values from a function?

626


Can a pointer be null?

558






Which of these functions is safer to use : fgets(), gets()? Why?

631


Why clrscr is used after variable declaration?

1035


What is the general form of function in c?

607


What is an lvalue?

632


What is sizeof c?

604


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2029


What is function what are the types of function?

554


Write a program to check prime number in c programming?

594


What is structure packing in c?

602


What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25

1492