static int *row;
// queen in column c is at row[c]
-static int abs(int i) {
+static int myabs(int i) {
if(0 > i)
i = -i;
return(i);
}
-boolean place_ok (int i) {
+static boolean place_ok (int i) {
// return whether queen in column i is
// not in check from queens left of it
int j = 0;
boolean res;
while (j < i) {
- if ((row[j] == row[i]) || ((abs(row[i]-row[j])) == (i-j))) {
+ if ((row[j] == row[i]) || ((myabs(row[i]-row[j])) == (i-j))) {
res = false;
return(res);
}
return(res);
}
-int solve (int n) {
+static int solve (int n) {
// return the number of solutions to the n-queens problem
int c = 0;
int res = 0;
}
static void usage (const char *progname) {
- printf("usage: %s\n", progname);
+ printf("usage: %s [n]\n", progname);
}