1 / 6

Chapter 8 Discussion

Chapter 8 Discussion. Chapter 8.1-8.3 and 8.5 (pp 383-408 and 417-425). Parameter passing mechanisms. Work in small groups Don’t look at the text or your notes List as many parameter passing mechanisms as you can recall. For each mechanism list a feature it enables or a benefit it supplies.

robyn
Download Presentation

Chapter 8 Discussion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 8 Discussion Chapter 8.1-8.3 and 8.5 (pp 383-408 and 417-425)

  2. Parameter passing mechanisms • Work in small groups • Don’t look at the text or your notes • List as many parameter passing mechanisms as you can recall. • For each mechanism list a feature it enables or a benefit it supplies

  3. Call by value • The following E3 program passes parameters by value. ( (global x 5) (global y 2) (fun f (x y) (local (temp x) (block (:= x y)(:= y temp))))) (f x y) • At theend of theprogramwhatholds? choose 1 • X has value 5 • Y has value 5 • Y has value 0

  4. Call by reference • The following E3 program passes parameters by reference ( (global x 5) (global y 2) (fun f (a b) (local (temp x) (block(:= x y)(:= y temp))))) (f x y) • At theend of theprogramwhatholds? choose 1 • X has value 2 • Y has value 2

  5. Call by value-return • The following E3 program passes parameters by value return ( (global x 5) (global y 9) (fun f (a b c) (block(:= a 1) (:= b 2))) ) (:= y (f x x y)) • At theend of theprogramwhatholds? choose 1 • X has value 1 • Y has value 2 • Y has value 9

  6. In and Out parameters • Work in small groups • Don’t look at the text or your notes • What’s the difference between In, out, CBV, and CBR?

More Related