Record Detail

Compile Error

/in/ex1.c: In function 'ex1':
/in/ex1.c:18:2: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Werror=implicit-function-declaration]
  gets(str);
  ^~~~
  fgets
/in/ex1.c:77:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='+') 
          ^
/in/ex1.c:82:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='-') 
          ^
/in/ex1.c:87:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='*') 
          ^
/in/ex1.c:92:12: error: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Werror=format=]
   printf("%f+%fi",sa3d,b3d);
           ~^
           %d
/in/ex1.c:92:15: error: format '%f' expects argument of type 'double', but argument 3 has type 'int' [-Werror=format=]
   printf("%f+%fi",sa3d,b3d);
              ~^
              %d
/in/ex1.c:145:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='+') 
          ^
/in/ex1.c:150:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='-') 
          ^
/in/ex1.c:155:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='*') 
          ^
/in/ex1.c:160:12: error: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Werror=format=]
   printf("%f+%fi",sa3d,b3d);
           ~^
           %d
/in/ex1.c:160:15: error: format '%f' expects argument of type 'double', but argument 3 has type 'int' [-Werror=format=]
   printf("%f+%fi",sa3d,b3d);
              ~^
              %d
/in/ex1.c:194:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='+') 
          ^
/in/ex1.c:199:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='-') 
          ^
/in/ex1.c:204:10: error: array subscript has type 'char' [-Werror=char-subscripts]
   if (str[loc_f[3]]=='*') 
          ^
/in/ex1.c:209:12: error: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Werror=format=]
   printf("%f+%fi",sa3d,b3d);
           ~^
           %d
/in/ex1.c:209:15: error: format '%f' expects argument of type 'double', but argument 3 has type 'int' [-Werror=format=]
   printf("%f+%fi",sa3d,b3d);
              ~^
              %d
/in/ex1.c:213:9: error: 'return' with a value, in function returning void [-Werror]
  return 0;
         ^
/in/ex1.c:3:6: note: declared here
 void ex1() {char str[100];
      ^~~
/in/ex1.c:5:6: error: unused variable 'cont_i' [-Werror=unused-variable]
  int cont_i;
      ^~~~~~
/in/ex1.c:30:9: error: iteration 100 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
   if(str[i]=='+'||str[i]=='-')
      ~~~^~~
/in/ex1.c:28:2: note: within this loop
  for (int i=0;i<=cont;i++)
  ^~~
/in/ex1.c:32:10: error: 'cont_f' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    cont_f++;  
    ~~~~~~^~
cc1: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Homework 4
Language
C
Submit At
2022-10-26 21:10:50
Judged At
2022-10-26 21:10:50
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes