I was going through random reading and i hit a page which says that the size of a structure in C can be "greater than" or equal to sum of sizes of its member. Plz can someone explain in which case its size is greater that sum of its member. Thanks in advance.
For efficiency reasons, sometimes a structure will have blank space or 'padding' inbetween its data members, to align the members to certain byte addresses, allowing for faster access. Its not something that will necessarily happen, but if the compiler decides that your program will run better because of it, it can. Hence, the only way to accurately determine the size of a structure is to use the sizeof operator.