CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

How does it work?

Everytime you call a function:

  • computer "remembers" where to come back;
    • address of next instruction is saved
  • computer makes a copy of each argument passed by value
    • so that the function uses this copy
  • starts executing the function
  • any variables declared in the function are created

 

As you return from a function

  • local variables are discarded
  • computer goes back to where it was.
  • example