struct MyDataType
{
};
int main()
{
MyDataType a;
int size = sizeof(a);
}
struct MyDataType
{
int i;
char c1;
char c2;
short s;
};
int main()
{
MyDataType a;
int size = sizeof(a);
}
struct MyDataType
{
int i;
char c;
char c2;
};
int main()
{
MyDataType a;
int size = sizeof(a);
}
struct MyDataType
{
char c;
int i;
short s;
};
int main()
{
MyDataType a;
int size = sizeof(a);
}
struct MyDataType
{
char c;
int i;
short s;
};
int main()
{
MyDataType a = { 1, 2, };
}
struct MyDataType
{
char c;
int i;
short s;
};
int main()
{
MyDataType a = { 1, 2, };
a.i = 10;
a.s = 0;
a.c = 100;
return 0;
}
struct MyDataType // 구조체 선언
{
char c1;
int i;
short s;
};
int main()
{
MyDataType t = {};
// 1
t.i = 10;
t.s = 10;
t.c1 = 10;
MyDataType* pMyData = nullptr;
pMyData = &t;
// 2
//*pMyData;
(*pMyData).i = 10;
(*pMyData).s = 10;
(*pMyData).c1 = 10;
// 3
pMyData->i = 10;
pMyData->s = 10;
pMyData->c1 = 10;
return 0;
}
typedef int MYINT;
typedef int* MYINTP;
int main()
{
MYINT i3 = 0;
MYINTP k = nullptr;
}
F12 : 선언위치로 간다.
#include <iostream>
typedef int MYINT;
typedef int* MYINTP;
// 구조체 크기 확장규칙을 1바이트로 제한
#pragma pack(1)
struct MyDataType
{
int i;
short s;
char c1;
};
int main()
{
// 구조체 자료형으로 변수 선언 및 초기화
MyDataType a = { 1, 2, };
int size = sizeof(a);
// 구조체 변수의 맴버에 접근해서 값을 입력
a.i = 10;
a.s = 0;
a.c1 = 100;
{
MyDataType t = {};
MyDataType* pMyData = nullptr;
pMyData = &t;
t.i = 10;
t.s = 10;
t.c1 = 10;
(*pMyData).i = 10;
(*pMyData).s = 10;
(*pMyData).c1 = 10;
pMyData->i = 10;
pMyData->s = 10;
pMyData->c1 = 10;
}
return 0;
}
1차 23.12.08
2차 23.12.11
3차 23.12.12
4차 23.12.14
5차 23.12.17
6차 23.12.25
7차 24.01.01
8차 24.01.23