#include<stdio.h> #include<string.h> int main() { char str1[80],str2[80]; int i.j=0; gets(str1); for (i=0;i<strlen(str1);i++){ if(str1[i]<'0'||str1[i]>'9') { str2[j]='*'; if(str1[i+1]>='0'&&str1[i+1]<='9') { j++; } } else str2[j++]=str1[i]; } } puts(str2); return 0; } /* Main.c: In function 'main': Main.c:6:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token int i.j=0; ^ Main.c:6:8: error: expected expression before '.' token Main.c:7:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(str1); ^ Main.c:8:8: error: 'i' undeclared (first use in this function) for (i=0;i<strlen(str1);i++){ ^ Main.c:8:8: note: each undeclared identifier is reported only once for each function it appears in Main.c:11:20: error: 'j' undeclared (first use in this function) str2[j]='*'; ^ Main.c:5:17: warning: variable 'str2' set but not used [-Wunused-but-set-variable] char str1[80],str2[80]; ^ Main.c: At top level: Main.c:22:4: warning: data definition has no type or storage class puts(str2); ^ Main.c:22:4: warning: type defaults to 'int' in declaration of 'puts' Main.c:22:4: warning: parameter names (without types) in function declaration Main.c:23:4: error: expected identifier or '(' before 'return' return 0; ^ Main.c:24:1: error: expected identifier or '(' before '}' token } ^ */ |
Double click to view unformatted code.