jones@hal.uvm.edu (mrj) (01/23/91)
First I know that QuickC 2 is out.... but for those that have QuickC 1,
watch this. (somebody came to me and asked why the following code
wouldn't work.....)
#include <stdio.h>
int array[10][3];
int i,j;
int main()
{
for (i=0;i<10;i++)
{
j = i + 1;
array[i][0] = j;
array[i][1] = j * j;
array[i][2] = j * j * j;
}
for (i=0;i<10;i++)
printf("%4d %4d %4d\n",array[i][0],array[i][1],array[i][2]);
}
Uh.. the output from QuickC looks something like this...
First line...
0 0 1
I can't remember the rest, but lets just say that it wasn't in anyway
the expected output. I used the MIPS C compiler, and Turbo C 2.1 to
get the correct output (both gave...), so I must guess the QuickC 1.0
has a bug. (correct and expected output.)
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000
You can understand what a new programer would wonder, if the example from
a book didn't work !!!
Mike.
jones@uvm.edu