Lec10 - Lecture 10 Void functions Two kinds of arguments...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 10 Void functions and root finding 1 Lecture 10 Void functions Two kinds of arguments Passed by value one way to the function but not back Passed by reference two way, can return changed from the function Global Variables Root finding Successive substitution Bisection method
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Lecture 10 Void functions and root finding 2 A simple example This argument is passed by reference This argument is passed by value. c returns from the void function with the value of 30 (which was z in the function). simplevoid2.cpp code can be found in the Examples page. a and b do not get returned changed!
Background image of page 2
Lecture 10 Void functions and root finding 3 Functions: variable scope Global variables are defined above the main() These variables are available inside all functions. Can be done for const or any type of variable. However, it is only recommended for constants.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Lecture 10 Void functions and root finding 4 Using a global variable Because d is declared outside of the main, it is global and is accessible and changeable everywhere. d gets a value here,
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/26/2008 for the course ENGR 1 taught by Professor X during the Spring '07 term at Lehigh University .

Page1 / 17

Lec10 - Lecture 10 Void functions Two kinds of arguments...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online