I am trying to write a very simple pointer assignment in C++ like this:
float *src;
if(someCondition == true)
src = somePointer;
else
src = someOtherPointer;
However, when I try to access src, I get a warning saying "Dereference of null pointer( loaded from variable src)"
Also, if I try to give some initial value to src like this:
float *src = aPointer;
if(someCondition == true)
src = somePointer;
else
src = someOtherPointer;
I get a warning saying that the initial value assigned to src is never read. Even though this doesnt seem to be affecting what I am trying to do, I am trying to get rid of all potential issues. What seems to be the problem here?
Any help is appreciated. Thanks!
someCondition?somePointerandsomeOtherPointer?somePointerandsomeOtherPointerare established please.