Hello. So I have a vector of structs and I want to traverse it, find a struct that matches a constraint and obtain a pointer to that struct. I made a function for this purpose which takes a number and an empty pointer that will store the reference. However, after function returns the pointer becomes null.
The problem is that you are passing the pointer into your function by value.
If you want your function to modify the pointer in a way that is reflected in the calling code, you need to pass it by reference - just as you would for any other type of argument.