I was curious how much memory SDL_Surfaces use, so I tried the following:
all three of them resulted in 60 bytes, even though the images are of different dimensions. How are SDL Surfaces stored in memory and do they all use 60 bytes regardless of size??? (In my opinion hard to believe, but I'm a novice programmer, so...)Code:int Background = sizeof(*Surface_Background);
int Cards = sizeof(*Surface_Cards);
int Title = sizeof(*Surface_Title);
Another question: The way I see it a boolean variable should only use one bit, but I read somewhere that the smallest amount of memory which can be allocated is a byte, therefore a bool variable uses a byte. I tried this:
and it displayed 1 and 8 respectively. My question is, since a boolean technically only uses a bit, shouldn't an array of 8 bools still only allocate 8 bits or 1 byte?Code:bool Test1;
bool Test2[8];
cout << sizeof(Test1) << endl;
cout << sizeof(Test2) << endl;