C++ – Understanding and Implementing sizeof Operator

c++

I know C++ and know the function sizeof itself but I need to write my own sizeof function so please explain how it works exactly? What does it do with the parameter?

Best Answer

sizeof is a compiler built-in operator. It is evaluated at compile-time by the compiler, and there is no runtime code behind it. You cannot write your own.

Asking this is akin to asking how you would write your own version of return.

Related Question