It will return a value of 42 at the point of call because


Write a C function that includes the following sequences of statements:

x = 21;
int x;
x =42;

Run program and explain the results. Rewrite the same code in C++ and Java.

I understand Java:
Looks like this;
Java:
public int myMethod(int x)
{
x = 21;
x = 42;
return x;
}

It will return a value of 42 at the point of call, because the first value of 21 in x gets overwritten by the new value 42

Need help with C and C++ please.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: It will return a value of 42 at the point of call because
Reference No:- TGS01250869

Now Priced at $20 (50% Discount)

Recommended (97%)

Rated (4.9/5)