Removing the char array returned by getenv ()

Should I free the memory allocated for the char array, the pointer to which is returned by the function char * getenv( char * )? And in which direction - C free()or C + delete []? If not, why?

I mean:

char * ptr = getenv( "LS_COLORS" );
cout << ptr << endl;
delete [] ptr; //Is this or free() call needed?

Thank.

+5
source share
2 answers

environ ( char * ), getenv() environ, , undefined.

+5

Getenv . , , , . ( , , , , - .)

+4

All Articles