I was writing a c++ code and came to use the 'strcmp' command, but I don't know if I should include the string.h library as in c.
The c++ code used 'strcmp' without including the string.h library, but there was no error. Why didn't there be an error?
Student* StdSearch(Student* pSt, char* name, int StdNum)
{
Student* find = 0;
for (int i = 0; i < StdNum; i++)
{
if (strcmp((pSt + i)->StdName, name) == 0)
{
find = pSt + i;
return find;
}
}
if (find == 0)
return NULL;
}