I got tasked to make a typedef which will represent an array of numbers from 0 to 127.
The numbers cannot repeat - it's a set of integers.
This is not good because it consumes too much data:
typedef struct set {
char array[128];
} some_set;
as for later this data structure will be used to define different sets (set_a
, set_b
, set_c
, etc.) which will be used for different operations like:
print_set
which will print the setunion_set
which combines 2 sets into a 3rd setintersect_set
which will intersect 2 sets and save the data in the 3rd
Someone suggested to represent each number with a bit, but I can't really wrap my head around it.