if(strcmp(un,this->username)==0 && strcmp(pw,this->password)==0)
Could anyone of you please instruct me the significance of "this" function? Also, what could be a possible alternative of it?
if(strcmp(un,this->username)==0 && strcmp(pw,this->password)==0)
Could anyone of you please instruct me the significance of "this" function? Also, what could be a possible alternative of it?
It's only necessary if you need to distinguish the member variable username
from one that's local to the function that contains your if
statement.
The same applies to password
.
If neither apply then you can write
if (!strcmp(un, username) && !strcmp(pw, password))
By the way, using a contiguous character array to store a password is not particularly secure. You wouldn't see code like this in a professional context.