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

Constant Type

Hi All,,

I could not understand about what is meant by Type of a constant data type ?? forexample why is it needed to write a constatnt like 0x123455678L .. what does this trailing L means ??
What are the other trailers for Constants ??

Thankzz && Bye.
-Rocknmoon

  • EVERY operand in an expression has a type. Since constants are always used as parts of expressions, they must have a type. Suffixes like U, L, F specify the type of the constant which can be different from that without suffix. Thus you can avoid type casting of a constant.
    Actually, why not read a book on C?
    - Mike

  • "Thus you can avoid type casting of a constant."

    More importantly, you can avoid the default 'C' types giving you unexpected results! Remember, 'C' assumes that everyting is an int unless explicitly told otherwise!

    "why not read a book on C?"

    Quite right: this is a 'C' language issue - nothing specifically to do with Keil!

  • HUmm,, interesting..

    Thanks for the help.

    About readingthe C book.. i can tell you that at times i have found such quick and accurate information on these forums that would be hard to find it books.

    Thanks again.
    Bye.

  • "at times i have found such quick and accurate information on these forums that would be hard to find it books."

    You need to read a good book (preferably, books) to lay a solid foundation on which to build your programming skill.
    By all means ask questions here, but don't skimp on those foundations!