0

in C# if I have function that prints the two values it gets assumed its called print... in the following case what is the output

int i=0;
public int current_I(){return i;}
public int next_I(){return ++i;}
//---------
print(next_I(),current_I());

in other words can we know which function will execute first {current_I or next_I} or its just like the C++ we can never know the sequence of execution of the parameters ?

Filburt
  • 17,626
  • 12
  • 64
  • 115
Hilmi
  • 3,411
  • 6
  • 27
  • 55

1 Answers1

6

Function parameters are evaluated strictly left-to-right.

Look for the line

During the run-time processing of a function member invocation (Section 7.4.3), the expressions or variable references of an argument list are evaluated in order, from left to right, as follows:

above the third set of bullet points.

Rawling
  • 49,248
  • 7
  • 89
  • 127