samedi 11 septembre 2021

Can we allocate any number of byte we want in c++ ? (allocate 6 bytes for example for a type)

I'm trying to make a program for chess and in most cases I would need only 4, 6 or 8(here I can use char) bytes. So can I create a type that use 4 bytes, or an array with 4 bytes per cases ? It would lead to an significant gain in memory (and in efficiency ?).

Thanks all.

Aucun commentaire:

Enregistrer un commentaire