Have you ensured title
is within the scope of main()? It is quite possible you only have it available within the function that previously declared it.
Update: I recommend you compile and see for yourself, although assuming it is above the first for loop inside main, then yes. However the title should be unique, three digits long (padded if necessary) and initially zero; I recommend you create a function for that, so you can call
char* title = get_filename();
where get_filename
looks something like:
int count = 0;
char* get_filename()
{
// Dostuff
count++;
}
Alternatively you can also use static
variables, which "remember" their state between function invocations.