io farei così
codice:
char *buf;
buf = malloc(4);
a = 10;
b = 20;
sprintf(buf, "%d", a);
sprintf(buf + 2, "%d", b);