주석 부탁드립니다.
빵돌
질문 요약 :#include stdio.h#define SIZE 10void bubble (int *, const int, int (*)(int, int));int ascending(const int, const int);int descending(const int, const int);void main() {
int a[SIZE]={2,6,4,8,10,12,89,68,45,37};int counter, order;printf( Enter 1 - 오름차순 정렬 : \n);printf( Enter 2 - 내림차순 정렬 : \n);scanf(%d, &order);printf(\n 원래 데이터 \n);
&;
for(counter = 0; counter=SIZE-1; counter++printf(%4d, a[counter]);
if(order==1) {bubble(a, SIZE, ascending);printf(\n 오름차순으로 정렬된 데이터 \n);}
elsebubble(a, SIZE, descending);printf(\n 내림차순으로 정렬된 데이터 \n);}for(counter=0; counter=SIZE-1;counter++)printf(%4d, a[counter]);printf(\n);}void bubble(int *work, const int size,int(*compare)(int, int)){int pass, count;p;void swap(int *, int *);for(pass=1;pass=size-1;pass++)
for(count=0; count=size-2; count++)
if((*compare)(work[count], work[count+1]))
swap(&work[count], &work[count+1]);
}void swap(int *element1ptr, int *element2ptr){
int temp;
temp=*element1ptr;
*element1ptr=*element2ptr;
*element2ptr=temp;
}
int ascending(const int a, const int b){
return ba;
}
int descending(const int a, const int b){
return ba;
}질문 내용 : 빨간 부분의 주석을 부탁드립니다. 간단해도 됩니다. 의미만 알수있게.