# smallest data type use upto 2 digits

hii guys
I want to use a data type which takes the min space as there is no space left. even smaller than int and if boolean then can i do computation on that upto two digits?

Post your code. What is it that is taking up space ?

Bearing in mind that you say

even smaller than int

it is almost certain that you are using the wrong data type somewhere.

INt taking 2 byte
but boolean is taking 1 byte
i want even more less data type, is there more or can i compress it using something?

You can squeeze 2 decimal digits into a byte if you really need to, but will need code to pack them in and extract them.

Please post the program that you are having trouble with.

An uint8_t takes one byte and you can store numbers from -128 to +1270 to 255. That’s the smallest you can go.

Some other ideas:
You can combine smaller ‘units’ in structs with bitfields.
You can use an uint8_t to store 8 flags and get rid of 8 boolean variables

But post your code as requested for proper help.

let me try uint8_t

Laharsh:
let me try uint8_t

It's the same as byte and hence the same size as bool Why don't you show your code?

Laharsh:
INt taking 2 byte
but boolean is taking 1 byte
i want even more less data type, is there more or can i compress it using something?

depends on a number of factors

1. what is the maximum 2 digit number you need to have? 10 14 42 99 ? ? ? ? ?
2. what is the minimum 2 digit number you need?
3. are all intermediate values used?

The 3 answers determines the number of bits you need per 2 digit number

Furthermore the next question is also important
4) how many of them do you need? 1, 10, 100, 1000, more?

If you need a lot you can use a compact / dense arrays.
See - https://github.com/RobTillaart/Arduino/tree/master/libraries/BitArray

recently I used an optimized version of this technique to calculate a 2134 digit fibonacci number
(I had to hold two 2134 digit numbers in less than 2K RAM)

If you never need to take the address of a Boolean variable, you can store eight booleans in a byte, so with some simple arithmetic, an array of booleans can be easily implemented with functions.

sterretje:
An uint8_t takes one byte and you can store numbers from -128 to +127. That’s the smallest you can go.

Doesn’t the “u” in “uint8_t” stand for “unsigned”?

odometer:
Doesn't the "u" in "uint8_t" stand for "unsigned"?

It does

odometer:
Doesn't the "u" in "uint8_t" stand for "unsigned"?

OOPS

the uint8_t worked successfully thankss

OP, I suspect that if you’re having trouble with available RAM to this extent, it won’t be long before you’re back, asking about memory corruption and crashing.

If you genuinely need to store a lot of bits, use bit-fiddling. To squeeze two digits into a byte, use the hight and low four bits.

But I suspect the real answer to the OP's problem is: "don't do it that way".