我需要在循环的每次迭代内形成一个字符串,其中包含循环索引i:
for(i=0;i<100;i++) {
// Shown in java-like code which I need working in c!
String prefix = "pre_";
String suffix = "_suff";
// This is the string I need formed:
// e.g. "pre_3_suff"
String result = prefix + i + suffix;
}
我尝试使用strcat和itoa没有运气的各种组合。