getopt switch statement never hitting default case
问题 I've tried searching and haven't found a duplicate/similar question. How come "default" is never triggering in this case? Working on some previous homework assignments for a course to prepare for the fall, and I'm having an issue with getopt() in C. Here are the particular lines in question: while ((c = getopt(argc, argv, "i:o:")) != -1) { switch (c) { case 'i': inFile = strdup(optarg); break; case 'o': outFile = strdup(optarg); break; default: usage(); //this prints the "usage" statement and