void AccountList::SelectionSort() {
int i, k, indexOfNextSmallest, temp;
double temp3;
char temp1, temp2;
for (i = 0; i < in.count - 1; i++){
indexOfNextSmallest = i;
for (k = i+1; k < in.count - 1; k++)
if (theID[k].ID < theID[indexOfNextSmallest].ID)
indexOfNextSmallest = k;
temp = theID[i].ID;
theID[i].ID = theID[indexOfNextSmallest].ID;
theID[indexOfNextSmallest].ID = temp;
strcpy(temp1, firName[i].fName);
strcpy(firName[i].fName, firName[indexOfNextSmallest].fName);
strcpy(firName[indexOfNextSmallest].fName, temp1);
strcpy(temp2,laName[i].lName);
strcpy(laName[i].lName,laName[indexOfNextSmallest].lName);
strcpy(laName[indexOfNextSmallest].lName,temp2);
temp3 = theBalance[i].balance;
theBalance[i].balance = theBalance[indexOfNextSmallest].balance;
theBalance[indexOfNextSmallest].balance = temp3;
}}
This is the code but when I try to compile it, lines 13-18 all say either:
"invalid conversion from `char' to `char*' "
then
"initializing argument 1 of `char* strcpy(char*, const char*)' "
I have no idea what these mean because I don't believe I ever used * which is to what I've learned so far a pointer?
Thank you ;-;.
Edit: It works when I change char temp1, temp2; to char temp1[32], temp2[32];
Not sure if this method is right though..