DAY05
Wednesday, 23 May 2012
-
complex_numbers.c, the book says that
the gcc compiler can't handle complex numbers, but that's no longer true.
Here's a simple program that suggests how it's done.
-
earth_division.c, a program which estimates
how much land we could evenly allocate every person on the earth. It
needs to compute a square root.
-
hello.c, the C source for the hello program.
-
hello_e.c, the result of the "gcc -E hello.c"
command (preprocess only).
-
hello.s, the result of the "gcc -S hello.c"
command (preprocess and compile into assembly language only).
-
hello.o, the result of the "gcc -c hello.c"
command (preprocess, compile into assembly language, and create machine language).
-
hello, the result of the "gcc -o hello hello.c"
command (preprocess/compile/machine/link, plus rename to "hello").
This program is executable (but only on the machine where it was compiled.)
-
my_sqrt.c, a function (not a program!) which
we will try to use as a replacement for the C sqrt() function.
-
prime.c, a simple program which tries to figure
out whether a number is prime; it demonstrates the BOOL datatype,
the use of the MODULUS operator "%", and the fact that multiplication
and division are carried out left to right, so that sometimes you need
parentheses to get what you really want. Also, we have a sneak peek
at the FOR loop, and at the mysterious "i++" operator.
-
square_root.c, a simple program to compute
the square root of a number;
-
square_root2.c, a more complicated version
of the square root program;
Last revised on 23 May 2012.