Sams Teach Yourself C in 21 Days

(singke) #1

DAY 18


WEEK 3


Getting More from


Functions


As you know by now, functions are central to C programming. Today you will
learn more ways to use functions in your programs, including


  • Passing pointers as arguments to functions

  • Passing type voidpointers as arguments

  • Using functions with a variable number of arguments

  • Returning a pointer from a function
    Some of these topics have been mentioned earlier in this book, but today’s les-
    son provides more detailed information.


Passing Pointers to Functions ............................................................................


The default method of passing an argument to a function is by value. Passing
by valuemeans that the function is passed a copy of the argument’s value. This
method has three steps:

29 448201x-CH18 8/13/02 11:14 AM Page 515

Free download pdf