casting - Is the "(int)" in "sizeof (int)" a typecast operator or some special case parameter? [C] -
this question has answer here:
i assumed c expression sizeof (int) worked function, whatever inside parentheses being passed parameter. int (or other type specifier) keyword , not object can passed, assumed sort of special case hard coded compilers.
but discovered if use sizeof on variable, can omit parentheses (sizeof var) , it'll compile , run fine. since sizeof operator , not function (and operators don't need parentheses), , types specifiers things need parentheses, i'm wondering if they're type specifiers or if they're type cast operators somehow being used sizeof find sizes corresponding types.
() used sizeof operator if operand data type.
c11: 6.5.3.4 (p2):
the
sizeofoperator yields size (in bytes) of operand, may expression or the parenthesized name of type. size determined type of operand.
Comments
Post a Comment