The name of the function is not the only thing that distinguish the function itself from other functions. When you create (or better declare) a function you tell the compiler about 3 important and different points:
- return type
- function's name
- parameters passed to the function
in your case you want to use the same function's name but different parameters . You can do it without problems and create those two functions as you wrote in your question.
void gotoIJ(int i, int j){
...
}
void gotoIJ(coordinate element){
...
}
I guess you don't return anything from those functions and therefore I set the returning type to void .
So when in your main or anywhere else you call the function gotoIJ, the compiler will automatically call the correct one according to the parameters you pass.