I need to store boolean information for around 10000 variables. First I thought of using a bool array arr[10000] but it takes 40000 bytes. But I need to store this information in a memory efficient way. Maybe using bit manipulation? Also another thing that I need to store it globally and allocate it dynamically also. Can you please help me with this?
I need to store boolean information for around 10000 variables. First I thought of
Share
You could do:
Though to be the fastest, you should use whatever the word size is sized chunks. So on a 32-bit computer: