제목 : 18.6. new와 delete를 사용한 객체 생성 : NewDelete.cpp
글번호:
|
|
159
|
작성자:
|
|
레드플러스
|
작성일:
|
|
2005/08/18 오후 9:39:20
|
조회수:
|
|
3859
|
#include <iostream.h>
void main()
{
int *intNum = new int;
*intNum = 10;
cout << "값 : " << *intNum << endl;
cout << "주소 : " << intNum << endl;
cout << "크기 : " << sizeof(intNum) << endl;
cout << "크기 : " << sizeof(*intNum) << endl;
delete intNum;
double *dblNum = new double;
*dblNum = 10.0;
cout << "값 : " << *dblNum << endl;
cout << "주소 : " << dblNum << endl;
cout << "크기 : " << sizeof(dblNum) << endl;//주소 : 4
cout << "크기 : " << sizeof(*dblNum) << endl;//실수 : 8
delete dblNum;
}