void sortAlphabetically(int listLength, contactInfo* arrayOfStructs)
{
contactType temp;
for (int i = 0; i < listLength; i++)
{
if (strcmp(arrayOfStructs[i].contactName, arrayOfStructs[i+1].contactName) > 0)
{
temp = arrayOfStructs[i]; //swapping entire struct
arrayOfStructs[i] = arrayOfStructs[i+1];
arrayOfStructs[i+1] = temp;
}
}
}
void sortAlphabetically(int listLength, contactInfo* arrayOfStructs) { contactType temp; for (int i = 0; i
Share
The following expression is invalid when
i == (listLength-1)(assuming thatlistLengthis a count of the number of elements inarrayOfStructs):