목록구조체 할당 (1)
영넌 개발로그

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