James [on his mailserver] wrote:

> why doesn't this work:
>
> {
>         int c;
>
>         for (c=0; c==9; c++)
>                 /* something */
> }
> it will work if you use:

 for (c=0; c!=9; c++)


> i tried it once and it didn't work as expected (i can't remember what
> happened, it either looped for ever, or just skipped it).
>
> and, is this a Bad Thing...
>
> {
>         for (int c=0; c<10; c++)
>                 /* stuff */
> }
>

for C  'int c' inside the loop cinditional will not work.

> And here's something that my C Programming tutor does:
>
> main ()
> {
> /* whatever */
> exit (0);
> }
>
> shouldn't it really be
>
> int main ()
> {
> /* things */
> exit (0);
>
> return (0);
> }
>
> to conform to the ANSI C standard? doing gcc -Wall picks this up (type of
> main defaults to int) and i know this is just not done:
>
> void main (void)
> {
> /* things */
> exit (0);
> }
>
> :)
>
> someone recommend a good C reference book (reference, not tutorial...)


Reply via email to