Notes - 2.7 - Function definition includes header and body...

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

View Full Document Right Arrow Icon
, E E 312 Notes February 7 2008 - A named collection of statements o Somewhat like mathematical functions o Arguments are not required - Does not need to return a value - - Functions are like mini programs called by name - : Top line declarations - Library Functions o Stdlib o Stdio o Math o Time o Ctype o String o Assert o A few others - How does it work? o Partitioning the problems Divide them up No one part is complex Must balance the fact of not too many and not enough functions o Many way to Partition One of the fundamentals is to craft a design Reduce complexity
Background image of page 1

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

View Full DocumentRight Arrow Icon
Increase clarity Increasing reusability o Defining Operates on parameters Either have a side effect or return a value or even both Call these functions by name
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Function definition includes header and body inside function Has a return data type Could also be typedef Can not be an array : Ex--(-) Return type function name parameter list { Declarations Statements }-Parameter List o Must be preceded by a specification of its type o Like a declaration statement o ( , ) Int average float a float b-Function body o Can be empty o May contain declarations and other statements o All variables declared in the body of this function is only to that function-Exit Libraray o . In stdlib h o ( ) Exit 0 same as return 0 o ( ) ( ) – Exit EXIT_SUCCESS or EXIT_FAILURE exiting because of what? o...
View Full Document

This note was uploaded on 03/22/2008 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas at Austin.

Page1 / 3

Notes - 2.7 - Function definition includes header and body...

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

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