KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I was hoping somebody could explain why #include <stdbool.h> printf("size of bool %d\n", sizeof(bool)); printf("size of int %d\n", sizeof(int)); outputs to size of bool 1 size of int 4 I've looked at http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html which seems to indicate that bool is essentially a macro for _Bool which, when set to true or false, is really just a macro for an integer constant. If it is an integer, why is it not the same size? I'm asking because it took us far too long to debug a program for which we did not allocate enough memory.
Tags (comma-separated)
Save Edits
Cancel