The & symbol in a C++ variable declaration means it’s a reference.
It happens to be a reference to a pointer, which explains the semantics you’re seeing; the called function can change the pointer in the calling context, since it has a reference to it.
So, to reiterate, the “operative symbol” here is not *&
, that combination in itself doesn’t mean a whole lot. The *
is part of the type myStruct *
, i.e. “pointer to myStruct
“, and the &
makes it a reference, so you’d read it as “out
is a reference to a pointer to myStruct
“.
The original programmer could have helped, in my opinion, by writing it as:
void myFunc(myStruct * &out)
or even (not my personal style, but of course still valid):
void myFunc(myStruct* &out)
Of course, there are many other opinions about style. 🙂
Related Posts:
- What are the differences between a pointer variable and a reference variable in C++?
- initial value of reference to non-const must be an lvalue
- error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
- Reference to non-static member function must be called
- C++ pass an array by reference
- Is C++ Array passed by reference or by pointer?
- Linker Error C++ “undefined reference ” [duplicate]
- Return array in a function
- What does “dereferencing” a pointer mean?
- Regular cast vs. static_cast vs. dynamic_cast
- What is a smart pointer and when should I use one?
- What does “dereferencing” a pointer mean?
- What is a char*?
- What exactly is nullptr?
- Are the C++ & and * operators inverses in all contexts?
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- How to fix a “invalid operands to binary expression” error?
- What is a dangling pointer?
- (->) arrow operator and (.) dot operator , class pointer
- Pass a vector by reference C++
- What is uintptr_t data type
- What is the difference between const int*, const int * const, and int const *?
- how does the ampersand(&) sign work in c++?
- C++ – No matching member function for call to ‘push_back’
- What is uintptr_t data type
- What does int & mean
- What is the difference between const int*, const int * const, and int const *?
- Difference between const reference and normal parameter
- Pointer to incomplete class type is not allowed
- Passing a 2D array to a C++ function
- Is the practice of returning a C++ reference variable evil?
- Can’t resolve Error: indirection requires pointer operand (‘int’ invalid)
- When should I use the new keyword in C++?
- How to create a dynamically-allocated array of const objects, but have values assigned to them?
- How to access the contents of a vector from a pointer to the vector in C++?
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- What does int & mean
- C++: Expression must have a constant value when declaring array inside function
- Sorting Linked List C++ with pointers
- Delete 2D array C++
- Is the sizeof(some pointer) always equal to four?
- C++ Expression must have pointer-to-object type
- C++ strings and pointers
- Typedef function pointer?
- How to initialize a vector of pointers
- What is the use of intptr_t?
- Error: No instance of constructor matches the argument list
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- C++ – Assigning null to a std::string
- Using C-string gives Warning: “Address of stack memory associated with local variable returned”
- Why use pointers?
- C++ Return value, reference, const reference
- What’s the difference between * and & in C?
- How to create a vector of class objects in C++?
- Function stoi not declared
- C++ Array of pointers: delete or delete []?
- Why should I use a pointer rather than the object itself?
- Function stoi not declared
- C++ correct way to return pointer to array from function
- Warning: comparison of distinct pointer types
- Is null reference possible?
- Initializing pointers in C++
- Why can’t I make a vector of references?
- Difference between function arguments declared with & and * in C++
- Difference between the int * i and int** i
- set head to NULL (‘NULL’ : undeclared identifier)
- What is a `char*`?
- clearing a vector of pointers [duplicate]
- C++ Swapping Pointers
- Meaning of *& and **& in C++
- Array of Linked Lists C++
- Differences between unique_ptr and shared_ptr
- Very basic C++ program issue – Invalid operands to binary expression
- Passing an array by reference
- Why use conio.h?
- Why is enum class preferred over plain enum?
- How to fix C++ error: expected unqualified-id
- How to use the PI constant in C++
- How to concatenate two strings in C++?
- How to get current time and date in C++?
- where is the official c++ documentation
- How to debug ‘Stack smashing detected’?
- basic_string::_M_construct null not valid after constructing subvector of strings
- Does C++ have a Garbage Collector?
- Is “argv[0] = name-of-executable” an accepted standard or just a common convention?
- gcc/g++: “No such file or directory”
- Error: expected type-specifier before ‘ClassName’
- What does “Permission denied” “Id returned 1 exit status” mean?
- When does an Incomplete Type error occur in C++
- std::cin input with spaces?
- extended initializer lists only available with
- C++ getInt() function (have a java equivalent attached)
- Simple string parsing with C++
- member access within null pointer of type ‘struct ListNode’
- How does c++ represent negative value
- Incrementing in C++ – When to use x++ or ++x?
- Use of undefined type [duplicate]
- Compiling C++11 with g++
- ERROR C2039: ‘vector’: is not a member of ‘std’
- Finding square root without using sqrt function?