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 sizeof operator yields size (in bytes) of operand, may expression or the parenthesized name of type. size determined type of operand.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -