TimLinden
TimLinden

Reputation: 117

What does the bitwise operator & do in this example?

This example is from MQL4 but that doesn't really matter:

int OnCalculate( const int       rates_total,
                 const int       prev_calculated,
                 const datetime &time[],
                 const double   &open[],
                 const double   &high[],
                 const double   &low[],
                 const double   &close[],
                 const long     &tick_volume[],
                 const long     &volume[],
                 const int      &spread[]
                 )

What does matter is that I don't understand what the bitwise operator & is telling me here.

I know what happens if you have 2 variables and use it var1 && var2 but in this situation with an array, could someone help me out here?

Upvotes: 1

Views: 102

Answers (1)

Christian
Christian

Reputation: 7852

The &in the argument indicates pass-by reference and not bitwise and. Passing by reference as opposed to pass-by value means that the argument value isn't copied, instead it's the address to the data structure that is copied and passed in to the function.

Edit: see @Sneftel's comment below about pass-by reference

Upvotes: 1

Related Questions