Assuming student::name is a char array or pointer to char , the following expression
sName==Student.name
compares pointers with char , after attenuation of sName from char[28] to char* .
Given that you want to compare the container of strings in these arrays, an easy way is to read the names in std::string and use bool operator== :
#include <string> // for std::string std::string sName; .... if (sName==Student.name)//Student.name is also an std::string
This will work for names of any length and relieve you of problems with arrays.
source share