c++ - What is the best practice of using itoa() -
c++ - What is the best practice of using itoa() - when utilize itoa() needs char* _dstbuff, best practice here? #include "stdafx.h" #include <iostream> using namespace std; int main() { int num = 100; // i'm sure here no memory leak, needs know length. char a[10]; // causue memory leak? if yes, how avoid it? // , why can itoa(num, b, 10); excuted correctly since b // has allocated 1 char. char *b = new char; // difference between char *c , char *b // both can used correctly in itoa() function char *c = new char[10]; itoa(num, a, 10); itoa(num, b, 10); itoa(num, c, 10); cout << << endl; cout << b << endl; cout << c << endl; homecoming 0; } the output is: 100 100 100 so explain differenct between char *b = new char; , char *c = new char[10]; here? i know char *c dynamiclly allocate 10 chars, means char *b dynamically allocate 1 char, if i'm right this, why output...