본문 바로가기

c++

이것이 c++이다 연습문제 1-3

1-3  char[12] 배열 메모리를 new 연산자로 동적 할당하고 해제하는 코드 예를 작성하세요.

 

정답:

 

#include "pch.h"
#include <iostream>
#include <tchar.h>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
char *nData = new char[10];
delete[] nData;
return 0;
}

 

'c++' 카테고리의 다른 글

이것이 c++이다 연습문제 1-6  (0) 2020.06.15
이것이 c++이다 연습문제 1-5  (0) 2020.06.15
이것이 c++이다 연습문제 1-4  (0) 2020.06.14
이것이 c++이다 연습문제 1-2  (0) 2020.06.14
이것이 c++이다 연습문제 1-1  (0) 2020.06.13