Chapter 3 -Part I - Lecture Notes

Chapter 3 -Part I - Lecture Notes - Chapter Chapter 3...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter Chapter 3 Functions . Part I Part I Ideas: 1. Functions are the result of a technique called: Divide-and-Conquer which allows the construction of large programs from small pieces called functions . 2. Writing a function is a three-step process: a. function prototype b. function call c. function definition 3. Function prototype, tells the compiler: a. the type of the data returned by the function {type of the result} b. the type of the parameters the function expects to receive c. the number the parameters d. The order in which the parameters are expected to be passed to the function. 4. The parameters of a function are local variables to that function. 5. Defining a function parameter again as a local variable in the function is a syntax error. 6. A function that does not return anything has a void return-type. 7. If nothing is written for the return-value-type of the function, then the compiler assumes it is int . 8. Even if int is assumed implicitly, always write int explicitly when the return-value-type expected is an integer. An exception to this rule is for function main () , for which the return-value-type can be omitted. 9. When the function has a return-value-type and the body of the function does not return any value, an error is generated by the compiler....
View Full Document

Page1 / 3

Chapter 3 -Part I - Lecture Notes - Chapter Chapter 3...

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

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