# Can you help me explain my this part of my code?

So, i made this code yesterday, wich means that my teacher showed me what to type, but i didn’t fully understand it. can some of you help me get an explaination on it?

This is the code.

``````int Cifer[10][7]={/*0*/{HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, LOW},
/*2*/{HIGH, HIGH, LOW, HIGH, HIGH, LOW, HIGH},
/*3*/{HIGH, LOW, LOW, HIGH, HIGH, HIGH, HIGH},
/*4*/{LOW, HIGH, HIGH, LOW, LOW, HIGH, HIGH},
/*5*/{HIGH, LOW, HIGH, HIGH, LOW, HIGH, HIGH},
/*6*/{HIGH, LOW, HIGH, HIGH, HIGH, HIGH, HIGH},
/*7*/{HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW},
/*8*/{HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH},
/*9*/{HIGH, HIGH, HIGH, HIGH, LOW, HIGH, HIGH}};

int T=0; //Counter

void setup() {
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}

void loop() {

for(int i = 0; i<7; i++){
digitalWrite(6+i, Cifer[T][i]); /*This is the part that i don't fully understand*/
}

T++;

if (T>9) T=0;[code]
``````

delay(1000);
}[/code]

T=0
i=0
digitalWrite(6, Cifer[0,0])
i=1
digitalWrite(7, Cifer[0,1])
i=2
digitalWrite(8, Cifer[0,2])
i=3
digitalWrite(9, Cifer[0,3])
...
T=1
i=0
digitalWrite(6, Cifer[1,0])
i=1
digitalWrite(7, Cifer[1,1])
i=2
digitalWrite(8, Cifer[1,2])
i=3
digitalWrite(9, Cifer[1,3])
...

``````void loop()
{
for (int i = 0; i < 7; i++)
{
digitalWrite(6 + i, Cifer[T][i]); /*This is the part that i don't fully understand*/
}
T++;
if (T > 9) T = 0;
delay(1000);
}
``````

Goes through each column of the 2 dimensional array (0 to 6 using i in the for loop) and outputs the value (HIGH or LOW) at each row (0 to 9) to the corresponding pin (6 + i ie 6 to 12)

Ask your teacher why they wasted so much space using ints for the array instead of bytes