Basics
Exercise 1: sizeof and alignof
Write a small program that prints the size (sizeof) and the alignment (alignof) of these types:
char,bool,int,float,double,void*std::vector<double>andstd::string
You can also do this in Compiler Explorer.
Exercise 2: member order
Write a struct with a char, a double and an int, in this order, and print its size and
alignment. Then change the order of the members.
- Does the size change? Try playing around with the orders