Modularity

The follwoing is an example of a function which was created to be a re-useable module. It can be used many times over to sum a sequence of numbers (from 0 to num) without writing the same code over and over.

int Sum10 (int num) { int answer, i; answer = 0; for ( i = 0; i <= num; i++ ) { answer += i; } return (answer); }


Main Page
Last Modified 3 October 2000