String manipulation in C is not something I'm used to, coming from higher level languages. In this situation, I want to be able to make a string of the form fooN where N is a variable representing a number. In Java, it would look something like
for (int N = 0; N < 5; n++) {
System.out.println("foo"+N);
}
which will output
foo0
foo1
foo2
foo3
foo4
However, I don't know a straighforward way to do that in C. I could probably hack something out where I make a char[] and figure out how to fill it up, but what I have in mind doesn't seem elegant. Is there a simple way that the C language allows concatenating strings and int variables?
Thanks
sprintf. It's similar toString.format.printf("foo%d", N);