fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5.  
  6. char* cek(char kalimat[][100],int a){
  7.  
  8. for(int i=0; i<strlen(kalimat[a]); i++){
  9. if(i%2 == 0 ){
  10. kalimat[a][i]=toupper(kalimat[a][i]);
  11. }
  12. else{
  13. kalimat[a][i]=tolower(kalimat[a][i]);
  14. }
  15. }
  16. return kalimat[a];
  17. }
  18.  
  19. int main() {
  20. int t, total=0;
  21. char kalimat[100][100];
  22.  
  23. do{
  24. scanf("%d", &t); fflush(stdin);
  25. }while(t>100);
  26.  
  27. for(int i=0; i<t; i++){
  28. scanf("%s", kalimat[i]); fflush(stdin);
  29. strcpy(kalimat[i], cek(kalimat, i));
  30. }
  31.  
  32. for(int i=0; i<t; i++){
  33. printf("%s\n", kalimat[i]);
  34. }
  35.  
  36. return 0;
  37. }
  38.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
lalalalla
hihihi joaoao
compilation info
prog.c: In function ‘cek’:
prog.c:8:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for(int i=0; i<strlen(kalimat[a]); i++){
  ^
prog.c:8:2: note: use option -std=c99 or -std=gnu99 to compile your code
prog.c: In function ‘main’:
prog.c:27:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for(int i=0; i<t; i++){
  ^
prog.c:32:10: error: redefinition of ‘i’
  for(int i=0; i<t; i++){
          ^
prog.c:27:10: note: previous definition of ‘i’ was here
  for(int i=0; i<t; i++){
          ^
prog.c:32:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for(int i=0; i<t; i++){
  ^
prog.c:20:9: warning: unused variable ‘total’ [-Wunused-variable]
  int t, total=0;
         ^
stdout
Standard output is empty