alexan_e
Administrator
Re: Questions About some shiftregisters
actually what I said above about using i>0 is wrong, you can use i>=1
---------- Post added at 18:14 ---------- Previous post was at 18:01 ----------
this is embarrassing , i>=1 is not correct too.. it will never execute the loop with 0
you can use i !=255
or you can make i a signed variable and use i>=0
actually what I said above about using i>0 is wrong, you can use i>=1
Code:
For loop
-------------------------------------------------------------
Is used to execute a statement or statement block a specified number of times.
for (expr1; expt2; expr3) { statement1; statement2; ... }
for (expr1; expt2; expr3) statement;
expr1 will be executed only one time at the entry of the for loop (assignment statement).
expr2 is a conditional control statement used to determine when to stay in the for loop.
expr3 is executed at the bottom of the statement and then expr2 is evaluated.
---------- Post added at 18:14 ---------- Previous post was at 18:01 ----------
this is embarrassing , i>=1 is not correct too.. it will never execute the loop with 0
you can use i !=255
Code C - [expand] 1 2 char i; for(i=7; i !=255; i--)
or you can make i a signed variable and use i>=0
Code C - [expand] 1 2 signed char i for(i=7; i>=0; i--)
Last edited: