Coder's Guild Mailing List

Re: problem with c code

Posted by Frank Hale on 1999-07-13

> where is the problem? this code compiles properly:
> 
> 
> #include <stdlib.h>
> 
> struct foo
> {
>   int a;
>   int b;
> }; // why the extra semi-colon here?
> 
> 
> int
> main()
> {
>   struct foo *foobar;
>   int c;
>   
>   foobar = malloc(sizeof(struct foo));
>   
>   if (1)
>     c = foobar->a;
>   else
>     c = foobar->b;
> 
>   if (1)
>   {
>     if(1)
>     {
>       c = foobar->a;
>     };// why the extra semi-colon here?
>   }
>   else
>   {
>     if(1) 
>     {
>       c = foobar->b;
>     }; // why the extra semi-colon here?
>   }; // why the extra semi-colon here?
> 
>   free(foobar);
> }; // why the extra semi-colon here?
> 

Look at the comments in the code. I don't think those
extra ;'s are needed in the code.

Frank
===
ICQ: 7205161
Webpage: http://jade.netpedia.net/
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com