为啥错了,求解
程序代码:
# include <stdio.h> # include <string.h> int main() { char a[100]="bkgsg624gfjehgf2398fgshe", b[100]; int i, j, n; n = 0; for (i=0; i<strlen(a); i++) { if (a[i]>='0'&&a[i]<='9') { n++; continue; } else for (j=0; i<strlen(a)-n; j++) b[j] = a[i]; //筛选出非数字的字符 } printf("输出剩余的字符: \n"); puts(b); printf("\n"); return 0; }
可能是这里:
for (j=0; i<strlen(a)-n; j++)
b[j] = a[i];
到这里以后就有问题了