strcmp, strcpy에서 계속 오류가;;
미즈
이름 10개를 입력받아 퀵정렬 하는 건데.. 계속 strcmp랑 strcpy에서 오류가 뜹니다;;
뭐가 잘못된건가요?? ㅠㅠ#include stdio.h
#include stdlib.h
#include string.h
#include memory.h#define MAX_SIZE 10
int n=10;
char list[MAX_SIZE][10]={가오리,바둑이,오징어,갑순이,왈왈이,칠득이,겸둥이,컴퓨터,라디오,스피커};void quick_sort ( char list[], int left, int right )
{
if(leftright){
int q = partition ( list, left, right );
quick_sort ( list, left, q-1 );
quick_sort ( list, q+1, right );
}
}
int partition ( char list[], int left, int right)
{
char pivot, tmp;
int low, high;
low = left;
high = right +1;
strcpy(pivot,list[left]);
do{
do
low++;
while ( low = right && strcmp(list[low],pivot)==-1 );
do
high--;
while ( high = left && strcmp(list[high],pivot)==1 );
if ( low high ) SWAP ( list[low], list[high], tmp );
} while ( low high ) ;
SWAP ( list[left], list[high], list[tmp] );
return high;
}int main()
{ quick_sort(list,0,n-1);
system(pause);
return 0;
}