DragonFly BSD
DragonFly users List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: coding question

From: "Devon H. O'Dell " <dodell@xxxxxxxxxxxxxxx>
Date: Mon, 11 Apr 2005 14:10:50 +0200
Mail-followup-to: users@crater.dragonflybsd.org

On Mon, Apr 11, 2005 at 11:49:16AM +0000, Terry Tree wrote:
> Can anyone tell me whats wrong here, I just can't get this piece of
> code to compile.  After looking over it several times I can't figure
> it out.

Do you have warnings turned off? When I try to compile that
code, I get:

> make test
cc -O -pipe   test.c  -o test
test.c: In function `main':
test.c:14: syntax error before `;'
test.c:19: continue statement not within a loop
test.c: At top level:
test.c:21: `nchars' undeclared here (not in a function)
test.c:21: warning: data definition has no type or storage class
test.c:22: syntax error before `while'
*** Error code 1

So, that would imply that you need to look at lines 14, 19, 21
and 22.

Line 14:
    for (i = 1; i < argc; i++;) {

This is invalid; the line should read:
    for (i = 1; i < argc; i++) {

You'll find that this change fixes all the errors. 


Attachment: pgp00012.pgp
Description: PGP signature

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]