possible use of uninitialized variable "balik"

To add comments, please log in or register
Yasir Kidil
80
Yasir Kidil  

hello, I take that warning when I use the #property strict

what should I do?

bool Short()
   {  
      bool   flag=false;
      double balik[4], giris[4];
      int    i, limit=ArraySize(balik);
      
      for(i=0; i<limit; i++)
         {      
            balik[i]=iCustom(NULL,0,"oho",Periyot,0,i);
            giris[i]=iCustom(NULL,0,"oho",Periyot,1,i);             
         }

      if (  balik[1]  >= Level      &&  
            giris[1]  >= Level      &&
            balik[1]  <  giris[1] && 
            balik[2]  >  giris[2]  )
            {
             flag=true;
            } 
      return(flag);
   }
Mohammad Hossein Sadeghi
2701
Mohammad Hossein Sadeghi  
Yasir Kidil:

hello, I take that warning when I use the #property strict

what should I do?

Use: ArrayInitialize for both balik and giris.
Yasir Kidil
80
Yasir Kidil  
Mohammad Hossein Sadeghi

I guess like this, right?

bool Short()
   {  
      bool   flag=false;
      double balik[4], giris[4];
      ArrayInitialize(balik,EMPTY_VALUE);
      ArrayInitialize(giris,EMPTY_VALUE);
      int    i, limit=ArraySize(balik);
      
      for(i=0; i<limit; i++)
         {      
            balik[i]=iCustom(NULL,0,"oho",Periyot,0,i);
            giris[i]=iCustom(NULL,0,"oho",Periyot,1,i);             
         }

      if (  balik[1]  >= Level      &&  
            giris[1]  >= Level      &&
            balik[1]  <  giris[1] && 
            balik[2]  >  giris[2]  )
            {
             flag=true;
            } 
      return(flag);
   }
Mohammad Hossein Sadeghi
2701
Mohammad Hossein Sadeghi  
Yasir Kidil:

I guess like this, right?

Yes, you should receive no warning.

Yasir Kidil
80
Yasir Kidil  
Mohammad Hossein Sadeghi:

Yes, you should receive no warning.

thank you, I tried and no warning

To add comments, please log in or register