Похожие чаты

Hi, i'm reading one byte from a file, so i

use a char for the datatype, however, i need to compare it to integers, rather than actual ascii characters, if i cast it to an int - it would take 4 bytes now, so i'm unsure if it'll work. how do i compare them? because i highly doubt there's a 1 byte int

8 ответов

17 просмотров

It's a char

I think you can compare it with an integer without casting the character to int type

Uint8_t is what u looking for?

artemetra 🇺🇦-[less active] Автор вопроса
Hsn
Uint8_t is what u looking for?

might be but this worked too

c will cast your char to an int. a char is just another integer type like int. But I'm guessing you'd want to compare '1' with 1 or '2' with 2, which is something different

artemetra 🇺🇦-[less active] Автор вопроса
Avihay B
c will cast your char to an int. a char is just an...

nope, i wanted to compare character codes, also i don't think it's any different in c++, is it?

artemetra 🇺🇦 [less active]
nope, i wanted to compare character codes, also i ...

you should prefer to compare and use other arithmetic operations with chars with chars and unsigned chars with unsigned chars. you can type an explicit keycode with char(48) or (unsigned char)(48)

Похожие вопросы

Обсуждают сегодня

30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
Also, why can’t the community have a vote/ say when it comes to initiatives like buybacks. Isn’t the point of crypto decentralisation? Don’t we deserve input as long term supp...
👨🏽‍🦰
13
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
16
any reference of this implementation?
BitBuddha
29
Hi guys, any problem with Pulsebrige? Trying to transfer from wETH to ETH. First it tells me to connect my metamask "through mobile app" not desktop. Then I did and confirmed ...
Snowflakecrypto
13
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
13
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Карта сайта