구조체를 return 하거나 function parameter 로 전달해야할 때 brace( {... } ) 를 이용한 리스트 형태 초기화를 많이 사용하고 있다.
struct Object
{
float first;
int second;
}Object returnSample()
{
return { 0.43f, 10 };
}void append(Object o) {}
void testCode(){Object oldO; oldO.first = 0.43f; oldO.second = 10;
Object newO = { 0.43f, 10 };Object a [] = { , , { 5.934f, 17} };
append( { 0.43f, 10 } );
}
728x90