Of int, char, float, and bool, which is smallest?

后端 未结 10 1305
傲寒
傲寒 2021-02-02 09:51

The following is from a \"fill-in at home\" programming test that is part of the application process for an MSc in game development at a UK university:

C+

10条回答
  •  面向向阳花
    2021-02-02 10:16

    The correct answer is boolean in theory, as a char requires knowledge of at least 8 bits, while a bool technically only requires one bit. you could smash 8 bools inside of a single char if you wanted to in theory.

提交回复
热议问题