char *STRING_to_CHAR(const string operand, const int operand_length) {
char *char_operand = new char[operand_length];
for (int i = 0; i < operand_length; i++) {
char_operand[i] = (operand.at(i));
}
return char_operand;
}
위 부분이 오류를 일으키는 핵심 부분인데요
string 자료형의 operand문자열을 입력받아서 문자배열로 바꾸는 함수를 만들려고합니다.
아래 사진처럼 12436895가 string으로 들어왔으면 문자배열로 똑같이 바뀌어야하는데
마지막에 쓰레기값이 계속 나타납니다.
![Cap 2018-03-24 00-23-25-344.png](http://thimg.todayhumor.co.kr/upfile/201803/1521818635e41bd30de74e4ea7b59f2b310cf6d0f9__mn613083__w307__h126__f6905__Ym201803.png)
해결책이 무엇일까요??