O
osmium
Bill Cunningham said:osmium wrote:
I have kandr2 and I will check that page but I have trouble
understanding kandr2. I have learned more from these sporatic tutorials
online.
I suggest
Page 155 tells you that the sequence ... has a particular meaning in the C
language, your post made it difficult to tell whether you were talking C or
talking English - they kind of blur together into a pudding.
It is clear now that you were merely wondering how to write the parameter
for an array of doubles. Given your current problem I would write it as
foo(double x[]);
but
foo(double* x);
would have compiled OK too. The first form tells the reader that x indeed
*is* an array. For a one dimensional array there is no need to put a number
in the brackets. But once you put a number there, the compiler is allowed
to (and mine does) check it for validity. DBL_MAX is the wrong type
(floating point instead of integral type and then if this were fixed the
number is much too big to be sensible. The pointer form (double* x) gives no
information as to what use x might have, it is simply a pointer.
It *can* make sense to put a number in there as a hint to the reader as to
what is going on, for example:
goo(int day[7]);
or
hoo(card[52];
contain helpful hints for the alert reader.
In your case no helpful hint seems possible, so I would leave the brackets
empty (as I did above).
The number given in the *prototype* will not actually be used by the
compiler, nevertheless it can cause warning messages.
The above assumes you were indeed writing a prototype, or function
declaration, since you didn't get as far as a semi-colon, we are left
guessing as to your plans.