moved #includes

master
Tibor Bizjak 2023-07-19 11:21:16 +02:00
parent 4efe1541d0
commit 44774f3582
1 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,4 @@
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
/* array bounds */
#define MAXLINES 100
@ -30,7 +28,9 @@ int main()
}
/* ---------- reading/printing functions */
#include <string.h>
#include <assert.h>
#include <ctype.h>
/* writelines: prints n lines */
void writelines(char *lines[], int n)
{
@ -76,13 +76,9 @@ int readlines(char *lines[], int maxlines, char *buffer, size_t buff_size)
}
/* ---------- string quicksort */
/* 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;
}
#include <string.h>
void swap(char *v[], int i, int j);
/* qsort_string: sort v[left]...v[right] into increasing order */
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);
}
/* 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;
}