Record Detail

Compile Error

/in/fileReverse.c: In function 'main':
/in/fileReverse.c:8:26: error: passing argument 2 of 'fopen' makes pointer from integer without a cast [-Werror=int-conversion]
  fp1 = fopen("test.txt", 'r');
                          ^~~
In file included from /in/fileReverse.c:1:0:
/usr/include/stdio.h:232:14: note: expected 'const char * restrict' but argument is of type 'int'
 extern FILE *fopen (const char *__restrict __filename,
              ^~~~~
/in/fileReverse.c:9:29: error: passing argument 2 of 'fopen' makes pointer from integer without a cast [-Werror=int-conversion]
  fp2 = fopen("reverse.txt", 'w');
                             ^~~
In file included from /in/fileReverse.c:1:0:
/usr/include/stdio.h:232:14: note: expected 'const char * restrict' but argument is of type 'int'
 extern FILE *fopen (const char *__restrict __filename,
              ^~~~~
/in/fileReverse.c:15:6: error: expected ';' before ')' token
   i++)
      ^
/in/fileReverse.c:19:16: error: implicit declaration of function 'strlen' [-Werror=implicit-function-declaration]
   for (int j = strlen(str[i]); j >= 0; j--)
                ^~~~~~
/in/fileReverse.c:19:16: error: incompatible implicit declaration of built-in function 'strlen' [-Werror]
/in/fileReverse.c:19:16: note: include '<string.h>' or provide a declaration of 'strlen'
/in/fileReverse.c:19:16: error: conversion to 'int' from 'long unsigned int' may alter its value [-Werror=conversion]
/in/fileReverse.c:19:3: error: declaration of non-variable 'strlen' in 'for' loop initial declaration
   for (int j = strlen(str[i]); j >= 0; j--)
   ^~~
/in/fileReverse.c:23:17: error: passing argument 2 of 'fputs' makes pointer from integer without a cast [-Werror=int-conversion]
   fputs(rev[i], 100, stdin);
                 ^~~
In file included from /in/fileReverse.c:1:0:
/usr/include/stdio.h:626:12: note: expected 'FILE * restrict {aka struct _IO_FILE * restrict}' but argument is of type 'int'
 extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
            ^~~~~
/in/fileReverse.c:23:3: error: too many arguments to function 'fputs'
   fputs(rev[i], 100, stdin);
   ^~~~~
In file included from /in/fileReverse.c:1:0:
/usr/include/stdio.h:626:12: note: declared here
 extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
            ^~~~~
/in/fileReverse.c:26:9: error: passing argument 1 of 'fclose' from incompatible pointer type [-Werror=incompatible-pointer-types]
  fclose("test.txt");
         ^~~~~~~~~~
In file included from /in/fileReverse.c:1:0:
/usr/include/stdio.h:199:12: note: expected 'FILE * {aka struct _IO_FILE *}' but argument is of type 'char *'
 extern int fclose (FILE *__stream);
            ^~~~~~
/in/fileReverse.c:27:9: error: passing argument 1 of 'fclose' from incompatible pointer type [-Werror=incompatible-pointer-types]
  fclose("reverse.txt");
         ^~~~~~~~~~~~~
In file included from /in/fileReverse.c:1:0:
/usr/include/stdio.h:199:12: note: expected 'FILE * {aka struct _IO_FILE *}' but argument is of type 'char *'
 extern int fclose (FILE *__stream);
            ^~~~~~
/in/fileReverse.c:6:8: error: variable 'fp2' set but not used [-Werror=unused-but-set-variable]
  FILE* fp2;
        ^~~
/in/fileReverse.c:5:8: error: variable 'fp1' set but not used [-Werror=unused-but-set-variable]
  FILE* fp1;
        ^~~
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Midterm Exam 2
Language
C
Submit At
2022-07-07 15:32:50
Judged At
2022-07-08 16:05:16
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes