sort by length

can u guys help me find out errors?
the error is "error: invalid use of member (did you forget the '&' ?)"
what should i do to fix it?
thx

1
2
3
4
5
6
7
8
9
10
11
12
  void sortByLength(string  stringArray[], int length){
	int i,k,j;
	string temp;
	for (int i=0; i<length-1; i++){
		if (stringArray[i].length > stringArray[i+1].length){
				temp=stringArray[i];
				stringArray[i]=stringArray[i+1];
				stringArray[i+1]=temp;	
		}
	}
}
Last edited on
 
if (stringArray[i].size() > stringArray[i + 1].size()){
Topic archived. No new replies allowed.