February 2020
Beginner to intermediate
616 pages
15h 16m
English
Follow these steps to create a compile-time assert expression that ensures that the user-defined structure is a specified number of bytes:
struct customers { int orderid; char customer_name[20]; float amount; };
static_assert(sizeof(struct customers) == 28, "The structure is consuming unexpected number of bytes");
Read now
Unlock full access