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.