• edited by
1,482 views
1 1 vote
Consider 2 cases:

1. Call by value result

2. Call by reference

int x = 10 ;
main ( )
{
P(x); printf (x);
}
P ( int a)
{
If ( a ≤ 40 )
{
a = a +10;
P(a);
x=a+10;
}
}
Please explain this in the above referenceIn case of call by reference the value of the actual parameter is simultaneously updated whereas, in case of call by value result, the final value of a formal parameter is passed to actual.
Any example in which these 2 will differ in output(especially in case of function calls)?

Please log in or register to answer this question.

Position:
Show:

Related questions

1 1 vote
1 1 answer
308
308 views
khanshahima4 asked Sep 24
308 views
1. If precedence tells me which operator has priority, and associativity tells me how to handle operators at the same level, then why do I need a separate concept called ...
14 14 votes
1 1 answer
1.4k
1.4k views
GO Classes asked Jul 2
1,377 views
Assume:$\texttt{short = 2 bytes}$, $\texttt{int = 4 bytes}$, $\texttt{char = 1 byte}$$\texttt{int}$ needs $4$-byte alignment and the final structure size is rounded to a ...
18 18 votes
2 2 answers
768
768 views
GO Classes asked Jul 2
768 views
Assume:struct Student { double gpa; }; struct Student alice; struct Student *sptr = &alice;Which of the following correctly assigns $\texttt{4.0}$ to $\texttt{alice.gpa}$...
10 10 votes
1 1 answer
570
570 views
GO Classes asked Jul 2
570 views
Consider the following code idea from the source:typedef struct { double x, y; } Point; void reset(Point p) { p.x = p.y = 0; } int main() { Point a = {12.0, 42.0}; Point ...