Last active
January 30, 2019 06:28
-
-
Save nunq/8d62293c9e180429dc27fc4cb7fca4ec to your computer and use it in GitHub Desktop.
decide things, supply options with commandline arguments
This file contains 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> | |
#include <time.h> | |
int main(int argc, char *argv[]) { | |
srand((unsigned)time(NULL) * getpid(NULL)); | |
char* resultString = argv[rand()%argc]; | |
if (resultString == argv[0]) { resultString = "try again"; } | |
printf("result: %s\n", resultString); | |
return 0; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment