Piece
[C] struct Initialization
More Code
2018. 6. 25. 23:09
참고 :
#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
*/