How to convert int to string in C? -


this question has answer here:

i'm trying convert integer string in c current code doesn't make it.

i'm not seeking display in screen, functions printf, sprintf... irrelevant.

int x = 15; char *t;     t = (char*)x; // expected result : "15" 

can please ?

thanks.

not displaying screen doesn't invalidate functions sprintf() since literally "print string".

int x = 15; char buffer[10]; memset(&buffer, 0, sizeof(buffer)); // 0 out buffer     sprintf(buffer, "%d", x); // expected result : "15" printf("contents of buffer: %s\n", buffer); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -