4 * Calculate the sum of a given range of integer numbers. The range is
5 * specified by providing two integer numbers as command line argument.
6 * If no arguments are specified, assume the predefined range [0..9].
7 * Abort with an error message if the resulting number is too big to be
8 * stored as int variable.
10 * This program example is similar to the one found in the GCOV documentation.
11 * It is used to demonstrate the HTML output generated by LCOV.
13 * The program is split into 3 modules to better demonstrate the 'directory
14 * overview' function. There are also a lot of bloated comments inserted to
15 * artificially increase the source code size so that the 'source code
16 * overview' function makes at least a minimum of sense.
29 int main (int argc
, char* argv
[])
33 /* Accept a pair of numbers as command line arguments. */
37 start
= atoi(argv
[1]);
42 /* Use both methods to calculate the result. */
44 total1
= iterate_get_sum (start
, end
);
45 total2
= gauss_get_sum (start
, end
);
48 /* Make sure both results are the same. */
52 printf ("Failure (%d != %d)!\n", total1
, total2
);
56 printf ("Success, sum[%d..%d] = %d\n", start
, end
, total1
);