I am trying to us a pointer to a struct in C++. I have struct wSignal with member MAC. I give the pointer of a struct to the function.
Definition struct:
struct wSignal
{
std::string MAC;
};
using the function:
wSignal it1 = {"22:44:66:AA:BB:CC"};
DoesPeriodExist(&it1);
definition of the function:
bool DoesPeriodExist (wSignal& s)
{
if(it1->MAC != "")
}
Error I get:
error: base operand of ‘->’ has non-pointer type ‘wSignal’
What am I doing wrong? How can I use the pointer? Sorry if this is a silly questions. I am not very familiar with pointers and am trying the understand the concept.
DoesPeriodExist(it1);; The reference is already in the definition of the function argument,.wSignal&specifies a reference type, not a pointerstruct wSignaliswSignal *s.if(it1->MAC != "")in the function - orif(s->MAC != "")?