Created
November 11, 2020 00:05
-
-
Save orumin/4d270d628903b37b47a57cc11cff9d45 to your computer and use it in GitHub Desktop.
coverage test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
void usage(char *cmd) | |
{ | |
fprintf(stderr, "%s: you need to pass arguments at least 1\n", cmd); | |
return; | |
} | |
int main(int argc, char **argv) | |
{ | |
if (argc < 2) { | |
usage(argv[0]); | |
exit(EXIT_FAILURE); | |
} | |
switch (argc) { | |
case 2: | |
printf("you passed 1 argument\n"); | |
break; | |
case 3: | |
printf("you passed 2 arguments\n"); | |
break; | |
default: | |
printf("you passed more than 3 arguments\n"); | |
break; | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment