HTML

TailWind 연습 https://to2.kr/dPr

TailWind 팝업 연습 to2.kr/dPs

C언어

Chapter 28. 구조체

#include <stdio.h>

int main(void) {
  int a;
  struct Person { // 구조체에 대한 설계도
    int person_age; // 4byte
    char* person_name; // 8byte
    char* person_hometown; // 8byte
    char* person_favorite_food; // 8byte
  };

  struct Person p;
  
  printf("%d\\n", sizeof(a)); // 4
  printf("%d", sizeof(p)); // 32
  return 0;
}

// 4 32 출력
struct 구조체이름 {
    멤버변수1의타입 멤버변수1의이름;
    멤버변수2의타입 멤버변수2의이름;
    ...
};

// int p; 의 구조
struct 구조체이름 변수명 { // 구조체 타입 선언, 포인터 (x)
	자료형 변수;
	자료형 변수;
	...
}
struct Person p1;
p1.age = 20;
p1.name = "홍길동";