let's say numbers are
1 2 3 4
5 6 7 8
Is that the correct psuedocode?Code:i=0;
j=0;
for(i=0;i<4;j++)
{
arr[i]=i;
}
for (j=0;j<4;j++)
{
arr[j]=j;
}
Printable View
let's say numbers are
1 2 3 4
5 6 7 8
Is that the correct psuedocode?Code:i=0;
j=0;
for(i=0;i<4;j++)
{
arr[i]=i;
}
for (j=0;j<4;j++)
{
arr[j]=j;
}
Multidimensional arrays are declared as int array[2][4] Where 2=rows, and 4= columns.
So in your case you would want
Code:int count=1;
for(i=0;i<2;i++){
for(j=0;j<4;j++)
{
arr[i][j]=count;
count++;
}
}