Is there a function that returns the ASCII value of a character? (C++)

前端 未结 5 1116
生来不讨喜
生来不讨喜 2020-12-31 05:14

I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc...

On a similar note, what is the function that converts between

5条回答
  •  鱼传尺愫
    2020-12-31 05:44

    As far as hex & binary - those are just representations of integers. What you probably want is something like printf("%d",n), and printf("%x",n) - the first prints the decimal, the second the hex version of the same number. Clarify what you are trying to do -

提交回复
热议问题