What\'s the difference between sizeof and alignof?
#include
#define SIZEOF_ALIGNOF(T) std::cout<< sizeof(T) << \'/\' << a
The alignof value is the same as the value for sizeof for basic types.
The difference lies in used defined data types such as using struct; for an e.g.
typedef struct { int a; double b; } S;
//cout<
hence the sizeof value is the total size required for the given data type; and alignof value is the alignment requirement of the largest element in the structure.
Use of alignof : allocate memory on a particular alignment boundary.