[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Inicial value
From: |
451707 |
Subject: |
[avr-gcc-list] Inicial value |
Date: |
Sun, 8 Feb 2004 18:34:49 +0100 |
User-agent: |
Internet Messaging Program (IMP) 3.1 |
My code is as simple as:
struct state{
int y, int yy, int t;
}
main(){
struct state S0={1,1,0};
struct state S1={0,0,0};
while(1){
if S0.y && S0.t>5{
....
S1.y = true;
....
....
}
if S1.y && ...{
....
}
//at the end of loop is updated S0.t
S0.t = S0.t + 1;
}
}
The first condition never is true due to the value of S0.t is always 0 at the
beginning. I have to initialized S0.y and S0.yy to begin the execution with
this state.
I´ve check the execution of the program without any part for AVR compiling
whit gcc and the values are correct.
I can´t understand the reasons.
Thanks
Mensaje citado por Douglas Dotson <address@hidden>:
> Hard to tell without seeing the code.
>
> Doug
>
> --- address@hidden wrote:
> >
> > Hello,perhaps is a trivial question:
> > I'm working with avr-gcc and when I give initial
> > value to two fields of a struc
> > at the beginnig of the main loop of my program all
> > the fields have the same
> > value, the initial value.
> > I've check that and the end of the loop the value of
> > fields is ok but at the
> > beggining of the loop it's become to the initial
> > value.
> > What's the problem?
> > Thanks