for bug?

for(int i=0; i<2; i++)
{
for (int j=0; j<array[i]; j++)
fprintf(f,"%d - called\n",array[i]);
}

array[0] and array[1] have "2" as value
but instead of getting 4 lines inside file i get only 2... why this??
What happens if you print array[j] instead?
There is nothing wrong with the loop.
Use printf instead of fprintf to be sure that array[0] and array[1] contain 2.
It doesn't print anything
This means that the problem is that your array is not initialized.
The array is initialized i get "2-called!" twice when i use array[i]
and nothing when i use array[j]
Is array[i] integers?
ok sorry i fixed it. it was the array..
it wasnt initialized right
thanks
Topic archived. No new replies allowed.