KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In C++, sizeof('a') == sizeof(char) == 1 . This makes intuitive sense, since 'a' is a character literal, and sizeof(char) == 1 as defined by the standard. In C however, sizeof('a') == sizeof(int) . That is, it appears that C character literals are actually integers. Does anyone know why? I can find plenty of mentions of this C quirk but no explanation for why it exists.
Tags (comma-separated)
Save Edits
Cancel