# 程設實習課 week 11
## Q1 : use pointer to implement swap
```c
#include <stdio.h>
void swap(, ) {
///to-do///
}
int main() {
int a,b;
scanf("%d %d", &a, &b);
printf("before:\n");
printf("%d %d\n", a, b);
///to-do///
printf("after:\n");
printf("%d %d\n", a, b);
}
```
```c
input:
1 2
output:
before:
1 2
after:
2 1
```
## Q2 : qsort
```c
#include <stdio.h>
void swap(, ){
///to-do///
}
void QSORT(int *nums, int left, int right){
if(left>=right) return;
int l=left+1;
int r=right;
int key=nums[left];
///to-do///
QSORT();
QSORT();
}
int main(void){
int array[10];
int len = sizeof(array) / sizeof(int);
for(int i = 0; i < len; i++){
scanf("%d",&array[i]);
}
QSORT(array,0,9);
for(int i=0; i<10; i++){
printf("%d ",array[i]);
}
}
```
```
intput:
9 1 3 7 8 2 6 4 5 0
output:
0 1 2 3 4 5 6 7 8 9
```