invalid conversion from char to char*?

So I'm almost done with my program and I'm trying to sort my output from smallest to biggest..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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..


EDIT: Nvm, I just fail.
Last edited on
Topic archived. No new replies allowed.