KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to clear a basic concept. This code works fine. Can somebody explain me that if the function calDouble already returning the address (reference) of int why I need to use & operator further in main int *j = &calDouble(i); to get the address (reference) of int? Thanks. int& calDouble(int x) { x = x*2; return x; } int main(int argc, char *argv[]) { int i = 99; int *j = &calDouble(i); system("PAUSE"); return EXIT_SUCCESS; }
Tags (comma-separated)
Save Edits
Cancel