Jul 22, 2012 at 12:23am
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??
Jul 22, 2012 at 12:29am
What happens if you print array[j]
instead?
Jul 22, 2012 at 12:32am
There is nothing wrong with the loop.
Use printf instead of fprintf to be sure that array[0] and array[1] contain 2.
Jul 22, 2012 at 12:32am
It doesn't print anything
Jul 22, 2012 at 12:36am
This means that the problem is that your array is not initialized.
Jul 22, 2012 at 12:37am
The array is initialized i get "2-called!" twice when i use array[i]
and nothing when i use array[j]
Jul 22, 2012 at 12:39am
ok sorry i fixed it. it was the array..
it wasnt initialized right
thanks