default 4 space code block
#include <stdio.h>
#include <stdlib.h> /*malloc()*/
void int2str(int, char *);
int main()
{
int i=123;
char *s = (char *)malloc(sizeof(char)); //remember cast malloc output (char *)
int2str(i, s);
printf("%s\n", s);
return 0;
}
void int2str(int i, char *s){
sprintf(s, "%d", i);
}
fency code block
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|