Sams Teach Yourself C in 21 Days

(singke) #1

DAY 5


WEEK 1


Packaging Code in


Functions


Functions are central to C programming and to the philosophy of C program
design. You’ve already been introduced to some of C’s library functions, which
are complete functions supplied as part of your compiler. Today’s lesson covers
user-defined functions, which, as the name implies, are functions defined and
created by you, the programmer. Today you will learn:


  • What a function is and what its parts are

  • About the advantages of structured programming with functions

  • How to create a function

  • How to declare local variables in a function

  • How to return a value from a function to the program

  • How to pass arguments to a function


09 448201x-CH05 8/13/02 11:15 AM Page 97

Free download pdf