Ex03-구조체 변수 초기화

CODEDRAGON Development/C, C++

반응형

   

구조체 변수 초기화

   

소스코드

   

#include <stdio.h>

struct point{
        int x;
        int y;
};

int main(void){
        //
구조체 변수의 선언과 동시에 초기화
        struct point sp1={10, 20};              //
구조체 변수의 초기화

        printf("%d %d \n", sp1.x, sp1.y);

        return 0;
}


   

   

출력결과

   

반응형