fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include<string.h>
  4. #include <time.h>
  5.  
  6. #define ARRAY_SIZE 10
  7.  
  8.  
  9. int main (void)
  10. {
  11.  
  12. int r;
  13.  
  14. srand(time(NULL));
  15.  
  16. r = (rand() % 3) + 1 ; //random number
  17.  
  18. printf ("%d\n", r);
  19.  
  20. char *names1[]= {"DOG" , "CAT", "HORSE" , "SNAKE" };
  21. char *names2[]= {"RAT", "FOX", "FISH", "DRAGON" };
  22. char *names3[]= { "TIGER", "COW", "SHARK", "BEAR" };
  23.  
  24.  
  25. printf (" %s %s %s", names1[r], names2[r], names3[r]);
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 2116KB
stdin
Standard input is empty
stdout
2
 HORSE FISH SHARK