Well, most mainstream languages at least specify their char size, and/or have very few constructs that require knowing its size. C does not specify the size of a char, and you frequently need the sizes of your types.
(That said, as pointed out by other comments, sizeof itself is in units of char, so sizeof(char) is necessarily 1.)
View all comments
Show parent comment
96
u/Batman_AoD Oct 05 '26
Well, most mainstream languages at least specify their char size, and/or have very few constructs that require knowing its size. C does not specify the size of a char, and you frequently need the sizes of your types.
(That said, as pointed out by other comments,
sizeofitself is in units ofchar, sosizeof(char)is necessarily 1.)