title: Initialize const char * with out any memory leaks
body: <p>Below is my sample code. Its just a sample which is similar to the code which i'm using in my applicaiton.</p>
  
  <pre><code>#define STR_SIZE 32
  
  void someThirdPartyFunc(const char* someStr);
  
  void getString(int Num, const char* myStr)
  {
    char tempStr[] = "MyTempString=";
    int size = strlen(tempStr) + 2;
    snprintf((char*)myStr, size, "%s%d", tempStr, Num);
  }
  
  int main()
  {
    const char * myStr = new char(STR_SIZE);
    getString(1, myStr); // get the formated string by sending the number
    someThirdPartyFunc(myStr); // send the string to the thirdpartyFunction
    delete myStr;
  
    return 0;
  }
  </code></pre>
  
  <p>I am getting an exception if i use this code. I think the problem is with deleting the "myStr". But delete is really necessary.</p>
  
  <p>Is there any other way to format the string in getString and send it to the ThirdPartyFunc?? </p>
  
  <p>Thanks in advance.</p>