hey guys i know its kinda noobish not to understand them since i been coding for 1 month but there rlly some stuff which confuses me in multidimensional array and nested loops like here in this program
I wanted to know if i sum up like in the array for example num[5][10] i wanted to know which get summed first if i did total+=num[x]; but here in this program i made i got weird error which i think shouldn't produce it so please someone enlighten me because till now i understand all stuff pointers memory management and hard stuff in C but i don't understand these multi and nested loops
#include <stdio.h>
int main(void)
{
int num[2][3]= {
{1,1,1},{1,1,1}
};
int i;
int x;
int total=0;
for(i=0;i<2;i++)
for(i=0;i<3;i++) {
total+=num[i][x];
}
printf("%d",total);
return getchar();
}
shouldnt it produce 6 ? please someone enlighten me in understanding this ....