Possible duplicate:
What are the differences between a pointer variable and a reference variable in C ++?
I hugged pointers to C (basics anyway) and started reading in C ++. The book that I am reading jumps right into the links, and the search in the index does not go to the pointers until later.
In C, I thought that if I wanted to skip the reference function, I would have to use pointers as arguments, for example.
void swapAandB(int *A, int *B){
But the C ++ book decides to put references to the source variable in the function. eg.
void swapAandB(int& A, int& B){
My book in C ++ did not explain why we do not use pointers, as in C. Therefore, I am a little confused. I think my question is: what's going on here?
user485498
source share