coding question

Devon H. O'Dell dodell at offmyserver.com
Mon Apr 11 05:14:00 PDT 2005


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. 

--Devon
Attachment:
pgp00012.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00012.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20050411/24fa747d/attachment-0019.obj>


More information about the Users mailing list