Uninitialised variable

 

Please can someone explain why I get the following warning from this code? (I know it's only a warning but why?)

int CheckTrades()
{
 int num_orders;
 for(int i=0;i<OrdersTotal();i++)
 { 
  if(OrderSelect(i, SELECT_BY_POS,MODE_TRADES)== True)       
  {                                                     
   //if order isn't for this symbol
   if(OrderSymbol()!= Symbol()) continue;
   
   num_orders++;
  }
 } 
  return(num_orders);
}

 After compiling

 

 
sd59:

Please can someone explain why I get the following warning from this code? (I know it's only a warning but why?)

 After compiling

 

Simply initialize it:

int num_orders=0; 

 
DeepThought:

Simply initialize it:

int num_orders=0; 

thanks (i'm not a programmer as you can tell!)
Reason: