I'm newbie in cpp and I'm having some doubt about memory leaking. I have this Method:
void MyClass::setBright(int bright){
std::string str = "sudo light -S ";
str+= std::to_string(bright);
const char *c = str.c_str();
std::system(c);
std::cout<< "brightsness adress is " << &c;
//delete [] c;
};
This Method is called multiple times, and I'm not sure if every time that I create
const char *c
it'll allocate a new address in my heap memory and the last const char *c will not be released. If this occurs, how can I avoid that?
I appreciate any help!