The first and third function is the same, and takes a pointer as argument. You can pass an array to the function because arrays can be implicitly converted to a pointer to the first element.
If you have a pointer to an int that you want to pass to the function you just pass it as it is.
1 2 3
int* p;
// Don't forget to initialize the pointer before passing it to the function.
somethingHappens(p)
If you have an int variable, and you want to pass a pointer to that variable to the function you can use operator&.
1 2
int i;
somethingHappens(&i);
Passing an array will look like this.
1 2
int array[3] = {1, 2, 3};
somethingHappens(array);
What is actually passed to the function is a pointer to the first element in the array, which is 1 in the example above.
The second function takes a reference to an int as argument. If you have an int variable, and you want to pass a reference to that variable to the function you just pass it as it is.
I'd just like to point something out: if you need to change the value of a built-in type through a function, don't pass it by reference; instead, prefer to return the new value:
1 2 3 4 5 6 7 8 9 10 11 12
int CreateNew_Value(int CurrentValue)
{
return(CurrentValue + ...);
}
int main( )
{
int Value(0);
// Do something...
Value = CreateNew_Value(Value);
}