fork download
  1. #include <stdio.h>
  2. #include<string.h>
  3.  
  4. int main(myString) {
  5. char myChars[] = myString;
  6. int length = strlen(S);
  7.  
  8. for (i = 0; i < length; ++i) {
  9. printf("%d = %c\n",i,myChars[i]);
  10. }
  11.  
  12. return 0;
  13. }
  14.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
"This is some text"
compilation info
prog.c: In function 'main':
prog.c:4:5: warning: type of 'myString' defaults to 'int' [-Wimplicit-int]
 int main(myString) {
     ^
prog.c:5:19: error: invalid initializer
  char myChars[] = myString;
                   ^
prog.c:6:24: error: 'S' undeclared (first use in this function)
    int length = strlen(S);
                        ^
prog.c:6:24: note: each undeclared identifier is reported only once for each function it appears in
prog.c:8:7: error: 'i' undeclared (first use in this function)
  for (i = 0; i < length; ++i) {
       ^
prog.c:8:2: warning: statement with no effect [-Wunused-value]
  for (i = 0; i < length; ++i) {
  ^
prog.c:8:16: warning: comparison between pointer and integer
  for (i = 0; i < length; ++i) {
                ^
prog.c:8:26: error: lvalue required as increment operand
  for (i = 0; i < length; ++i) {
                          ^
prog.c:8:2: warning: statement with no effect [-Wunused-value]
  for (i = 0; i < length; ++i) {
  ^
prog.c:9:34: error: array subscript is not an integer
      printf("%d = %c\n",i,myChars[i]);
                                  ^
prog.c:9:13: warning: format '%d' expects argument of type 'int', but argument 2 has type 'char *' [-Wformat=]
      printf("%d = %c\n",i,myChars[i]);
             ^
prog.c:9:13: warning: format '%c' expects argument of type 'int', but argument 3 has type 'char *' [-Wformat=]
prog.c:5:7: warning: variable 'myChars' set but not used [-Wunused-but-set-variable]
  char myChars[] = myString;
       ^
stdout
Standard output is empty