Void Type and NULL Constant

Overview

  • The void type is a fundamental MQL4 type.
  • It signifies that a function returns no value.
  • When used as a function parameter, void denotes the absence of parameters.
  • NULL Constant

  • NULL is a predefined constant variable of the void type.
  • It can be assigned to variables of any fundamental type without explicit conversion.
  • Comparisons between fundamental type variables and NULL are permitted.
  • NULL can also be compared to pointers to objects created with the new operator.
  • Usage Example

    // If the string is not initialized, then assign our predefined value to it
    if(some_string == NULL) some_string = "empty";
    

    Related Concepts

  • [Variables](/basis/variables)
  • [Functions](/basis/function)
  • [Typecasting](/basis/types/casting)
  • [User-defined Types](/basis/types/typedef)