I'm working in implementing an elevator

the project is about a building which has 2 elevators working together

I wrote a function (switch) to determine the direction of each elevator and that's my code

```
if( E1.loc == E2.loc )
{
if(upup1!=0 && dndn1!=0)
{
E1.status='u';
E2.status='d';
}
else
if(upup1!=0 && dndn1==0)
{
E1.status='u';
if(upup1>1)
{
E2.status='u';
}
}
```

upup1,dndn1,updn1,dnup1 are integers for E1

upup2,dndn2,updn2,dnup2 are integers for E2

when the 2 elevators are in the same location

I reached the condition of (upup1!=0 && dndn1==0)

E1 goes up

but the next condition (upup1>1) don't make E2 goes up

although I've initiallized upup1=2