関数によって返されるポインタであるchar配列に割り当てられたメモリを解放する必要がありchar * getenv( char * )
ますか? そして、どちらの方法 - Cfree()
または C+ delete []
? いいえの場合 - なぜですか?
つまり:
char * ptr = getenv( "LS_COLORS" );
cout << ptr << endl;
delete [] ptr; //Is this or free() call needed?
ありがとうございました。