TOC | Prev | Next

Functions

Functions are declared with

int square( int n ) {
    return n * n;
}

printf( "5*5 = %d\n", square( 5 ) );

Functions must call return to exit. Functions that return void
do not return a value. They don't have to call return but should.

Failing to return a value from a function that wants a value is
undefined.

TOC | Prev | Next