I think I'll go on a maniacal massacre if I don't find out how these things work. Kidding, although this has been driving me crazy for the past couple days :|. I've posted this question 3 times and still can't seem to get it. To me, it seems pointless and not that big a deal, I suppose, I just don't seem to catch on to it. Here's an example from the book:
1 2 3 4 5 6 7 8 9 10 11
|
void fn(int nArg)
{
nArg = 10;
}
int main()//originally was void parent()
{
int n1 = 0;
fn(n1);
}
|
This is what I believe the program is supposed to do:
1. Identify the 2 functions
2. The value of n1 gets taken to fn()
3. nArg is now and forever equal to 0 (until obviously the programmer changes the value by himself, but nevertheless, is equal to 0)
4. Nothing else changes, n1 is still equal to 0, and whatever fn() decides to do with that value is completley up to it (or the programmer).
SOO - in the end of this all
Nothing has changed in int main(), in fn(), the value that was originally 10, has changed to 0.
If this is wrong..can someone, in the EASIEST way possible explain how this whole thing is supposed to work. This has been killing me for days :(