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

Is c is a middle level language?

587


How many types of functions are there in c?

576


What is the advantage of using #define to declare a constant?

609


What is sizeof c?

595


Define and explain about ! Operator?

605






What is p in text message?

526


What is structure in c explain with example?

621


the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....

22161


Does * p ++ increment p or what it points to?

599


2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier.  Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed.  When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed.  Sequence of take-off is the sequence of addition to the waitlist

2506


write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3329


What is the difference between constant pointer and constant variable?

738


What does %d do?

705


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

760


Are the variables argc and argv are always local to main?

560