Consider the struct UserInfo, which is used in a performance critical sub-system.
Currently, on a system where an int takes 4 bytes, char takes 1 byte and long long takes 8 bytes, the struct takes 40 bytes of space. Rearrange the struct, without removing, renaming, or changing the type of the members, so that it uses less memory. The code uses pointers to struct members, so struct should be properly aligned.
- The UserInfo struct takes less than 40 bytes of memory: Wrong answer
- The UserInfo struct takes less than 25 bytes of memory: Wrong answer
- The UserInfo struct is properly aligned: Wrong answer