을 변경할 수 없습니다 :나는 다음과 같은 몇 가지 기능이 문자 포인터 (배열)
void MClass::GetS(char* buf, int max) const {
char *temp = new char[max];
temp[max] = '\0';
for (int i = 0; i < max - 1; i++)
temp[i] = src[i]; // src is class member (char *)
buf = temp; // buf is null after this o.O
}
그래서,이 기능에 버피 값을 변경할 수 없습니다. 왜 그것이 일어나는가?
정의되지 않은 동작입니다. – chris
코드가 메모리 누수 btw –
왜 발생합니까? – 0x499602D2