开发者

How to set a character in C++?

开发者 https://www.devze.com 2023-03-27 13:47 出处:网络
This is probably very obvious, in fact so o开发者_Python百科bvious that no C++ reference I could find online cares to document it.

This is probably very obvious, in fact so o开发者_Python百科bvious that no C++ reference I could find online cares to document it.

I need to know how to set the byte value of a char in C/C++. For example, if I want the byte value 233 in the char, how do I do?


Yes, it is too obvious:

char x = 233;


A char is a 1byte int. So you can set the value in the same way as you would an int.

char c = 123;
char d = 0x12;

etc...


char x = 233;

Yea, literally as simple as that.

0

精彩评论

暂无评论...
验证码 换一张
取 消