¿¹Á¦
int
main(
int
argc,
char
* argv[])
{
int
*a =
static_cast
<
int
*>(malloc(
sizeof
(
int
)));
delete
a;
int
*b =
new
int
;
free(b);
return
0;
}
¼Ö·ç¼Ç
malloc()·Î ÇÒ´çµÈ ¸Þ¸ð¸®¸¦ ÇÒ´ç ÇØÁ¦ÇÏ·Á¸é free()¸¦ »ç¿ëÇϰí, "new"·Î ÇÒ´çµÈ ¸Þ¸ð¸®¸¦ ÇÒ´ç ÇØÁ¦ÇÏ·Á¸é "delete"¸¦ »ç¿ëÇϽʽÿÀ.
int
main(
int
argc,
char
* argv[])
{
int
*a =
static_cast
<
int
*>(malloc(
sizeof
(
int
)));
free(a);
int
*b =
new
int
;
delete
b;
return
0;
}