CMPT 127 Lecture Notes - Lecture 16: Scanf Format String, C Mathematical Functions, Gnu Compiler Collection
Document Summary
As the syntax above indicates, function definitions can specify an arbitrary number of arguments, for example: double volume( double width, double height, double depth , return width*height*depth; However, c functions can have only a single return value. Go support multiple return values, so this asymmetry between the number of arguments and results was a design decision in c. it keeps the syntax simple. Since main() is a function, it should be apparent that functions can call other functions. In general a function may call any other function. One interesting situation is when a function calls itself, a process called recursion. Many algorithms are elegantly expressed as recursive functions. You may have seen this idea before: proof by induction relies on it. Above we looked at three function definitions: max(), output() and volume(). A function can be called in a c source code file below its definition. The compiler reads the source file from top to bottom.