#include <stdio.h>
#include <stdlib.h>
void main()
{
const int n = 2;
int i;
FILE *Fout[n];
char namafile[50];
for (i=1 ; i<=n ; i++)
{
printf("%d\n", i);
sprintf (namafile, "c:\\OS\\Result %d.txt", i);
Fout[i] = fopen(namafile, "w");
}
for (i=1;i<=n;i++)
{
fprintf(Fout[i], "test %d\n", i);
fclose(Fout[i]);
}
system("pause");
}
It won't work if there's no constant int
Can I change the constant "n", so I can use scanf("%d",&n) ??
thanks
still declaration syntax man :(