I have a question, what is the purpose of passing reference with reference arguments when you can do it by passing by reference with pointers?
            Asked
            
        
        
            Active
            
        
            Viewed 77 times
        
    1 Answers
2
            References provide stronger guarantee and thus compiler can do better job for example at optimization.
Moreover accessing references provides more intuitive code than pointers (My opinion, some people argue opposite). With references you get rid of null-pointer dereference issue (atleast in sane programs).
So always try to use references and use pointers when no other option is present.
 
    
    
        Mohit Jain
        
- 30,259
- 8
- 73
- 100
