Apr 14, 2004 #1 1Zivi Programmer Apr 14, 2004 1 BE Hi! Hope you can help my. I´d like to put a binary value into a char or int. ex: char x = 01000110; for hexa, I can write 0x25 for exemple. What must I write to put a binary value into a char? Thanks 1Zivi
Hi! Hope you can help my. I´d like to put a binary value into a char or int. ex: char x = 01000110; for hexa, I can write 0x25 for exemple. What must I write to put a binary value into a char? Thanks 1Zivi
Apr 14, 2004 #2 Salem Programmer Apr 29, 2003 2,455 GB You can't write binary constants like that in ANSI-C But then x = 10; // decimal x = 0xa; // hex x = 012; // octal All do the same thing, so any mythical x = 0b1010; // binary is no different from any of the above. -- Upvote 0 Downvote
You can't write binary constants like that in ANSI-C But then x = 10; // decimal x = 0xa; // hex x = 012; // octal All do the same thing, so any mythical x = 0b1010; // binary is no different from any of the above. --
Apr 14, 2004 #3 ArkM IS-IT--Management Oct 21, 2002 1,819 RU Strictly speaking, char constants are octal '\012' or hexa '\x0C' form... No difference in C where char constants have int type... Upvote 0 Downvote
Strictly speaking, char constants are octal '\012' or hexa '\x0C' form... No difference in C where char constants have int type...