Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert an int to char*?

Status
Not open for further replies.

ngen

Technical User
Mar 18, 2001
5
NL
Hi,

I wish to convert an integer to char* in C++ (I am using VC++).

Like:

int i = 10;
char *j =... <to convert int to char *>

printf(&quot;%s\n&quot;, j); <- here it will prints out 10.

Please help. Thanks.


 
int i = 10;
char* j = new char[10];
sprintf(j,&quot;number %d&quot;,i);
the most important is where is underlined. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top