Multiple For Loop

Hi i'm having problem in make a multiple For loop

I wrote this so I can initialize a matrix but for some reason my loop doesn't execute the second loop.


for (int a=0; a==5; a++){
   for (int b=0; b==5; b++){
   y[a][b]=0;
   };
};

When you initialize the variable at 0, the first thing it's checking is if it is equal to 5. Since you initialize it at 0, it'll never check true to 5, so it'll never check out as true.

Try

for(int a = 0; a <= 5; a++)

And repeat for b.
thanks, it worked.
Topic archived. No new replies allowed.