Record Detail

Compile Error

/in/fileReverse.c: In function 'main':
/in/fileReverse.c:4:19: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
     char fileName=argv[1];
                   ^~~~
/in/fileReverse.c:7:19: error: passing argument 1 of 'fopen' makes pointer from integer without a cast [-Werror=int-conversion]
     FILE* f=fopen(fileName,"r");//open
                   ^~~~~~~~
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 'char'
 extern FILE *fopen (const char *__restrict __filename,
              ^~~~~
/in/fileReverse.c:9:18: error: passing argument 1 of 'fscanf' from incompatible pointer type [-Werror=incompatible-pointer-types]
     while(fscanf("%c",f)!="\n"){
                  ^~~~
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from /in/fileReverse.c:1:
/usr/include/stdio.h:395:12: note: expected 'FILE * restrict {aka struct _IO_FILE * restrict}' but argument is of type 'char *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
/in/fileReverse.c:9:23: error: passing argument 2 of 'fscanf' from incompatible pointer type [-Werror=incompatible-pointer-types]
     while(fscanf("%c",f)!="\n"){
                       ^
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from /in/fileReverse.c:1:
/usr/include/stdio.h:395:12: note: expected 'const char * restrict' but argument is of type 'FILE * {aka struct _IO_FILE *}'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
/in/fileReverse.c:9:5: error: format not a string literal and no format arguments [-Werror=format-security]
     while(fscanf("%c",f)!="\n"){
     ^~~~~
/in/fileReverse.c:9:25: error: comparison between pointer and integer [-Werror]
     while(fscanf("%c",f)!="\n"){
                         ^~
/in/fileReverse.c:9:25: error: comparison with string literal results in unspecified behavior [-Werror=address]
/in/fileReverse.c:10:14: error: conversion to 'char' from 'int' may alter its value [-Werror=conversion]
         a[i]=fgetc(f);//getline
              ^~~~~
/in/fileReverse.c:13:1: error: statement with no effect [-Werror=unused-value]
 for (i;i>=0;i--) {
 ^~~
/in/fileReverse.c:3:14: error: unused parameter 'argc' [-Werror=unused-parameter]
 int main(int argc,char* argv[]){
              ^~~~
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Midterm Exam 2
Language
C
Submit At
2022-07-07 15:44:48
Judged At
2022-07-08 16:04:58
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes