I need to form a string, inside each iteration of the loop, which contains the loop index i:
i
for(i=0;i<100;i++) { // Shown in java-like cod
Use sprintf (or snprintf if like me you can't count) with format string "pre_%d_suff".
sprintf
snprintf
"pre_%d_suff"
For what it's worth, with itoa/strcat you could do:
char dst[12] = "pre_"; itoa(i, dst+4, 10); strcat(dst, "_suff");