티스토리 뷰

Piece

[C] struct Initialization

More Code 2018. 6. 25. 23:09

참고 :

C Structure Initialization


#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <windows.h>

struct x {
INT32 a;
INT32 b;
INT32 c;
};

int _tmain(INT32 argc, LPTSTR argv[]) {
struct x x1 = {0};
_tprintf(_T("%d %d %d \n"), x1.a, x1.b, x1.c);

struct x x2;
memset(&x2, 0, sizeof(x2));
_tprintf(_T("%d %d %d \n"), x2.a, x2.b, x2.c);

return EXIT_SUCCESS;
}

/* Output
0 0 0
0 0 0
*/


공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함