moved #includes
parent
4efe1541d0
commit
44774f3582
|
@ -1,6 +1,4 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/* array bounds */
|
/* array bounds */
|
||||||
#define MAXLINES 100
|
#define MAXLINES 100
|
||||||
|
@ -30,7 +28,9 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- reading/printing functions */
|
/* ---------- reading/printing functions */
|
||||||
#include <string.h>
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
/* writelines: prints n lines */
|
/* writelines: prints n lines */
|
||||||
void writelines(char *lines[], int n)
|
void writelines(char *lines[], int n)
|
||||||
{
|
{
|
||||||
|
@ -76,13 +76,9 @@ int readlines(char *lines[], int maxlines, char *buffer, size_t buff_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- string quicksort */
|
/* ---------- string quicksort */
|
||||||
/* swap: swap v[i] and v[j] */
|
#include <string.h>
|
||||||
void swap(char *v[], int i, int j)
|
|
||||||
{
|
|
||||||
char *temp = v[i];
|
|
||||||
v[i] = v[j], v[j] = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void swap(char *v[], int i, int j);
|
||||||
|
|
||||||
/* qsort_string: sort v[left]...v[right] into increasing order */
|
/* qsort_string: sort v[left]...v[right] into increasing order */
|
||||||
void qsort_string(char *v[], int left, int right)
|
void qsort_string(char *v[], int left, int right)
|
||||||
|
@ -103,3 +99,11 @@ void qsort_string(char *v[], int left, int right)
|
||||||
qsort_string(v, last+1, right);
|
qsort_string(v, last+1, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* swap: swap v[i] and v[j] */
|
||||||
|
void swap(char *v[], int i, int j)
|
||||||
|
{
|
||||||
|
char *temp = v[i];
|
||||||
|
v[i] = v[j], v[j] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue