variables: "Implicit initialization is not used."

To add comments, please log in or register
Carl Schreiber
Moderator
7282
Carl Schreiber  

Hi,

a question, just to be sure that it is meant what I assume:

Am I right, that (in contrary to mq4) variable don't get a value 0 on their definition:

// in mq4:
int i; // i == 0 - at least last year

//in mq5
int i; // i == random 

It could be just another trap of the code-migrating mq4 =0 mq5.

Thanks!

Alain Verleyen
36617
Alain Verleyen  
What the documentation says ?
Carl Schreiber
Moderator
7282
Carl Schreiber  
Alain Verleyen:
What the documentation says ?
"Implicit initialization is not used."
amando
937
amando  
Carl Schreiber:
"Implicit initialization is not used."

You are right carl, you have to set it to 0 

int i =0;

whroeder1
17927
whroeder1  

In MT4 without the use of strict, variables are initialized to zero by default. With only global variables.
          Updated MQL4 - MQL4 Reference

In MT5 there is no implicit initialization
          Language Basics / Variables / Initialization of Variables - Reference on algorithmic/automated trading language for MetaTrader 5

To add comments, please log in or register