How to convert int to string in C? -
this question has answer here:
- how convert int string in c 9 answers
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
Post a Comment