c - Logic behind sizeof operator -


this question has answer here:

here have sizeof operator in c. returning size of datatypes,

printf("%d",sizeof(some datatype)); 

and result 4 (os dependent).

i want know how calculating. logic behind operator. if ask write code sizeof operator. answer?

note : want know how sizeof written code capable calculate size.

as may not able ask question properly,i trying here again.

write 1 function can use instead of sizeof operator.

the compiler knows size of types, has or not able generate code correctly. information used sizeof operator.

also note sizeof not function being called @ runtime, it's operator evaluated during compilation.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -