struct_init

struct_init (구조체 초기화)

구조체를 중괄호 목록으로 초기화하는 방법을 다뤄요.

출처: cppreference

본문

구조체는 멤버 순서대로 중괄호로 초기화해요.

struct S { int a; double b; };
S s{1, 2.5};

집계 초기화의 한 형태로, 멤버를 생략하면 기본값이 돼요.

더 알아보기 (Learn more)

cppreference