본문 바로가기

영넌 개발로그

검색하기
영넌 개발로그
프로필사진 영넌

  • 분류 전체보기 (71)
    • 설치 (6)
    • 코딩 (60)
      • C++ (44)
      • python (1)
      • ML , Deep (13)
      • 캐글 (0)
    • 알고리즘 연습 (5)
      • 이론 (5)
      • python 프로그래머스 (0)
Guestbook
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록배열 할당 (1)

영넌 개발로그

[C++ 기초] 동적 구조체(struct) / 문자열 메모리 할당

C언어 struct 키워드를 구조체 이름 앞에 꼭 붙여야함 동적으로 구조체 공간 생성을 위해서는 malloc 사용, free로 해제 #include #include struct things { char name[20]; double weight; double price; }; int main() { using namespace std; struct things* pt = (struct things*)malloc(sizeof(struct things)); return 0; } C++ struct 키워드 없이 구조체 이름 만으로도 사용 가능 동적 구조체는 array와 똑같이 new와 delete 사용 #include struct things { char name[20]; double weight; doubl..

코딩/C++ 2020. 10. 23. 16:18
Prev 1 Next

Blog is powered by kakao / Designed by Tistory

티스토리툴바