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
What are the types of unary operators?
What is "Hungarian Notation"?
Explain the red-black trees?
What are qualifiers in c?
Where local variables are stored in c?
Do you know null pointer?
How can this be legal c?
What are run-time errors?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What are the types of type qualifiers in c?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Can we assign string to char pointer?
Is there sort function in c?
Explain what is a stream?
Tell us two differences between new () and malloc ()?