I have a loop for
* which counts from 1 to 8 and saves to an array call str
, but I I would like that when the variable str
reaches 8 the value of str[i]
in the array str_line[b]
Example:
for
loop starts str[i]
and saves in str[i]
str_line[b]
b
and start all over again i
is in 5 , for loop b
The program would do this during its execution:
str[1] = 1
str[2] = 11
str[3] = 111
str[4] = 1111
str[5] = 11111
str[6] = 111111
str[7] = 1111111
str[8] = 11111111
Guarda tudo que estiver em 'str[8]' em 'str_linha[1]';
Incrementa o 'b*'
E repete isso até o laço FOR fizer isso 5 vezes.
I am not able to transfer the value of for
to str[8]
, how can I do it?
My code so far:
char str[9];
char str_line[6];
int i;
int b;
for(i = 0; i < 8; i++)
{
str[i] = '0' + i;
Serial.println(str);
if(i = 8)
{
//Aqui guardaria o valor em str_line.
//Zera o ponteiro e começa a contagem do FOR desde o inicio
i = 0;
elseif(b = 5)
{
//Para o laço FOR
}
}
}