This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

binary notation

I just started using keil c51 compiler.
Since I know that keil is compatible to ANSI-C
I want to know if there is an ANSI-C
compatible notation for binary numbers.

Like when I want to write the number in hexadecimal notation
I use the prefix "0x"
->
0xFF

All oher numbers are considered to be in
decimal notation.
->
1234567890

But which prefix do I use for binary number system?

I already tried (0b..., ...b, ...) and got
->error C251: illegal octal digit
->error C141: syntax error near 'b'
...

By the way, it would be nice to know which notation to use for octal number systems.

Regards
J.

Parents Reply Children
  • Do not make the mistake of buying another "C and '51" book.

    Those books do NOT teach you C, they are "the 51' for programmers already versed in C".

    A good self-teach book would be Kochan: "Programming in ANSI C".

    It is so much easier to learn the C fundamentals on the PC than on a '51.

    PS: there are posts here or on 8052.com about free Borland C compilers for the PC which will allow you to work through the examples

    Erik

  • "PS: there are posts here or on 8052.com about free Borland C compilers for the PC which will allow you to work through the examples"

    One thing to beware of is that they're probably C++ compilers, and/or C99.

    Most embedded 'C' compilers (including C51) are the "original" ANSI 'C'

    Both C++ and C99 will accept "original" ANSI 'C', but will let you get away with things that a true "original" ANSI 'C' does not allow.

    There's often an option to enable "pure ANSI" mode...