--- In [email protected], "Nico Heinze" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "johmgolden051500" <johns_goldens@>
> wrote:
> >
> > --- In [email protected], "John Monte" <johns_goldens@> 
wrote:
> > Ok if you type in the following 
> >  void main ()
> > {
> >    bit
> > } 
> > The word bit will turn blue which indicate it is some type
> > of data type. I have one book that it shows is as bit 1 bit
> > long and the comments reads it as boolean value but it does
> > not shows any example of it.  What I am looking to do is
> > the following.
> >  unsigned char i;
> >  unsigned char flag; // using the varible each flag bit
> >        /* to indicate a flag */
> 
> First it's a very bad idea to use C++ style comments in C programs; 
if
> you program in C++, then use the // style, but if you work with C,
> then solely use /* and */ to enclose comments, nothing else.
> 
> >   if (flag && 1) ; when flag,0 = 1 then I will increment else i = 
10
> >      i++;
> >    else
> >      i = 0x0a;
> >  I want to use each bit of flag for some type of flag in my
> > prgram. When I try the above code and when flag bit 0 = 0 it
> > will not go to the else statement.
> <snip>
> 
> Very clear; you have inserted an empty statement (namely a 
semicolon)
> after the condition
>   if (flag & 1)
> The semicolon there will tell the compiler that there is an empty
> statement to be executed; so the "i++;" will always be executed, and
> then the "else" is "dangling" because there's no valid "if" before. 
So
> actually your compiler shouldn't compile this at all.
> 
> Furthermore: do you work with Turbo C++? Bad idea because it doesn't
> understand ANSI C or ANSI C++; it's far too old for modern 
standards.
> 
> Regards,
> Nico
>
The ; was a type error when I wrote this. I have to write in C 
because I am using a program from HI-TEC which is use for writing C 
to the mircochip. I have always wriiten in assembly code but the new 
software requires writing in C. I have book on C++ but some of the 
code will not work in the HI-TECH.
 Thnaks
 JJ 


Reply via email to