fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <time.h>
  5.  
  6. int main() {
  7. int a,b=0;
  8. char *q; //com *
  9. char *chamar(int z); //com *
  10. printf("escolhendo palavra...\n");
  11. srand(time NULL);
  12. a=(rand()%4);
  13. q = chamar(a);
  14. b=strlen(q);
  15. printf("%d",b);
  16. for(int x=0; x<b /*< em vez de <=*/; x++) {
  17. printf("_");
  18. }
  19. }
  20.  
  21. char* chamar (int z) {
  22. switch(z) {
  23. case 0: return "soda";
  24. case 1: return "hair";
  25. case 2: return "paper";
  26. case 3: return "telephone";
  27. case 4: return "sky";
  28. default: return "errinho";
  29. }
  30. }
  31.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
escolhendo palavra...
4____