Jump to content

Phil H

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Phil H

  1. Bignose, I will reread the tests again. I see what you are saying. I was looking for the program to actually do something, but it appears to be much simpler than that. If passed by value then x would print as 3. If x was passed as reference then it would print as 5. Thank you.
  2. So I am getting it the wrong way around? y sends 5 over and by value x prints out as 5. at the finish of this x is still 3 and y is still 5. If passed by reference then y passes 5 over and x prints as 8. at the finish of this, x is now 8 and y is 5.
  3. Hi, I am a 1st year computer science student doing my degree by distance education. I dont have anyone to bounce stuff off so any assistance would be really appreciated. I have been asked the following question............... The following is a program segment and the definition of a procedure named sub x <- 3; procedure sub (y) sub (x); y <- 5; print value of x; What value will be printed by the program segment if parameters are passed by value? Now I am taking it that the left is the calling program ( X ) and right is the procedure (Y ). So , to pass by value, program X sends its value of 3 over to procedure Y which leaves the value as 3. So the value 3 will be printed.................... And if it was passed by reference then X would pass 3 over to Y which would add the 3 to its value of 5.......... giving us a value of 8 passed back to the program on the left, which would then print a value X of 8............. Do I make sense? And am I on the right track. I do not want an answer. I just want to know if I understand, or not.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.