aaaaaa123456789 icon

JV's programming challenge, week 4, testing code 2

aaaaaa123456789 | PRO | 12/05/12 11:21:55 PM UTC | 0 ⭐ | 368 👁️ | Never ⏰ | []
C |

570 B

|

None

|

0 👍

/

0 👎

#include <stdio.h>
#include "week4.c"
 
int main (int argc, char ** argv) {
  if (argc < 2) {
    printf("No size specified. Usage: %s <size>\n", *argv);
    return 1;
  }
  unsigned short size;
  if (!sscanf(argv[1], "%hu", &size)) {
    printf("Invalid size specified.\n");
    return 1;
  }
  unsigned short current;
  unsigned short * result;
  for (current = 5; current <= size; current ++) {
    result = tour(current);
    free(result); // not gonna use it, just see if there is one!
    printf("% 4hu: %s\n", current, result ? "yes" : "no");
  }
  return 0;
}

Comments