Top "Sizeof" questions

sizeof refers to the Standard C/C++ operator for returning the size in bytes of an expression or datatype.

Why do C++ classes without member variables occupy space?

I found that both MSVC and GCC compilers allocate at least one byte per each class instance even if the …

c++ class sizeof predicate
What does 'sizeof (function name)' return?

Sample code: int main(void) { printf ("size = %d\n", sizeof(main)); } What is the returned value sizeof applied to a …

c function sizeof
Loop starting at -1 doesn't print anything

This program is supposed to print out the elements of array, but when it is run, no output is shown. #…

c loops integer sizeof negative-number
sizeof() structures not known. Why?

Why can't I use sizeof() on simple structs? eg: private struct FloatShortPair { public float myFloat; public short myShort; }; int size = …

c# struct sizeof
About sizeof of a class member function pointer

Let's say we have a class A class A; and these typedefs typedef void (A::*a_func_ptr)(void); typedef …

c++ class pointers sizeof member
Why sizeof int is wrong, while sizeof(int) is right?

We know that sizeof is an operator used for calculating the size of any datatype and expression, and when the …

c++ c sizeof