0

define variable

I want to define variable, for example I use byte, it should be 1 byte and it will be like normal number but in binary so only 0 ana 1, it can be for example 0, 10,011 or 10010.In code it will looks like int ... bit a=0; ...

28th Sep 2018, 5:48 PM
nicolas turek
nicolas turek - avatar
12 Answers
+ 1
can be + redefined?
28th Sep 2018, 8:03 PM
nicolas turek
nicolas turek - avatar
+ 1
ok,thanks
28th Sep 2018, 8:59 PM
nicolas turek
nicolas turek - avatar
0
actually no, C doesn't support binary literals. But you can use hex decimal instead like const int 0x55ab;
28th Sep 2018, 7:16 PM
BraveHornet
BraveHornet - avatar
0
i mean it like integer but only in digital(or octal/hexadecimal), then when i would write byte x = 10010 + 1010; x will be 11100, operators will be defined with #define but my question is how to make my own variable with it's name and characters
28th Sep 2018, 7:46 PM
nicolas turek
nicolas turek - avatar
0
to explain i'll write it in hexadecimal,it will be like typedef char hex; it could be only 0,1,2...D,E,F and others characters will cause error
28th Sep 2018, 7:57 PM
nicolas turek
nicolas turek - avatar
0
yes
28th Sep 2018, 8:02 PM
nicolas turek
nicolas turek - avatar
0
and do you know hot to do it using libraries?
28th Sep 2018, 8:05 PM
nicolas turek
nicolas turek - avatar
0
c or c++
28th Sep 2018, 8:08 PM
nicolas turek
nicolas turek - avatar
0
so it will be better just let it be string and use #define to define operators
28th Sep 2018, 8:20 PM
nicolas turek
nicolas turek - avatar
0
... int number,number2; char character; cin<<number<<character<<number2<<endl; if(character==43){number = plus(number,number2);} ... 43 is +
28th Sep 2018, 8:25 PM
nicolas turek
nicolas turek - avatar
0
where can i learn creating library?
28th Sep 2018, 8:36 PM
nicolas turek
nicolas turek - avatar
0
i mean it that i don't know about any useful website where i can learn anything
28th Sep 2018, 8:52 PM
nicolas turek
nicolas turek - avatar