#include <stdio.h> int main(){ char *arr[]; int i, j; scanf("%s", &arr); for(i=0;i<strlen(arr);){ if(j=i;j<strlen(arr)-1;j++){ arr[j]=arr[j+1]; } else{ i++; } } printf("%s", arr); } /* Main.c: In function 'main': Main.c:4:9: error: array size missing in 'arr' char *arr[]; ^ Main.c:6:3: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char * (*)[1]' [-Wformat=] scanf("%s", &arr); ^ Main.c:7:3: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] for(i=0;i<strlen(arr);){ ^ Main.c:7:13: warning: incompatible implicit declaration of built-in function 'strlen' for(i=0;i<strlen(arr);){ ^ Main.c:7:20: warning: passing argument 1 of 'strlen' from incompatible pointer type for(i=0;i<strlen(arr);){ ^ Main.c:7:20: note: expected 'const char *' but argument is of type 'char **' Main.c:8:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if(j=i;j<strlen(arr)-1;j++){ ^ Main.c:8:11: error: expected ')' before ';' token if(j=i;j<strlen(arr)-1;j++){ ^ Main.c:15:3: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char **' [-Wformat=] printf("%s", arr); ^ */ |
Double click to view unformatted code.