카테고리 없음
struct and new, delete operator
Su, Roh
2018. 2. 3. 12:08
#include "stdafx.h"
#include <iostream>
#include <string>
struct MyStruct {
int num1 = 1;
int num2 = 2;
double real1 = 0.5;
};
int main()
{
using namespace std;
const MyStruct *ptr = 0;
ptr = new MyStruct;
cout << ptr->num1 << " " << ptr->num2 << " " << ptr->real1 << endl;
delete ptr;
return 0;
}