#include <stdio.h>
#include <string.h>
typedef struct POINT {
float x;
float y;
float z;
} POINT_t;
int main() {
# C++ 20 부터 가능
POINT_t p = {.x = 10.0f, .y = 5.0f, .z = 0.0f};
// Memory setting
memset(&p, 0, sizeof(POINT_t));
return 0;
}
첫번째 변수 크기의 배수로 메모리를 구성함
float, float, char[10], short = 20 바이트
float, short, float, char[10] = 24 바이트
alignas, alignof