Simple But Devious C Programming Mistakes
C programs which
illustrate some simple but devious programming mistakes in C.
Note that because of the miserable random number interface in C,
it's possible to not compute the sum of 100 random numbers in
many interesting ways!
The computer code and data files made available on this web page
are distributed under
the GNU LGPL license.
C_MISTAKE is available in
a C version and
a FORTRAN90 version and
an HTML version and
a MATLAB version.
List of Routines:
MAIN is the main program for C_MISTAKE.
C_MISTAKE1 tries to make a table of integer powers.
C_MISTAKE2 tries to determine the sign (-1, 0, or +1) of real numbers.
C_MISTAKE3 sums 100 random numbers but isn't close to 50.
C_MISTAKE4 sums 100 random numbers but isn't close to 50.
C_MISTAKE5 sums 100 random numbers but isn't close to 50.
C_MISTAKE6 adds the values in an array.
C_MISTAKE7 computes the absolute value of sin(x).
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C source codes.
Last revised on 30 July 2016.