Wrong Answer
/in/foo.c: In function 'main':
/in/foo.c:13:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if (c == '\n')
   ^~
/in/foo.c:15:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    break;
    ^~~~~
/in/foo.c:18:23: warning: 'str' may be used uninitialized in this function [-Wmaybe-uninitialized]
     for (char *p=str; *p != '\0'; p++)
                       ^~
  代码
#include <stdio.h>
#include <ctype.h>
#define N 100
int
main(void)
{
    char str[N+1], c;
    int alpha = 0, num = 0, space = 0, other = 0;
	for (int i=0; i < N; i++)
	{	
        c = getchar();
		if (c == '\n')
			str[i] = '\0';
			break;
		str[i] = c;
    }
    for (char *p=str; *p != '\0'; p++)
    {
        if (isalpha(*p))
            alpha++;
        else if (isalnum(*p))
            num++;
        else if (isspace(*p))
            space++;
        else
        other++;
    }
    printf("%d\n%d\n%d\n%d", alpha, num, space, other);
    return 0;
}
      信息
- 递交者
 - 类型
 - 自测
 - 题目
 - 7.9统计个数
 - 语言
 - C
 - 递交时间
 - 2018-10-26 11:14:40
 - 评测时间
 - 2018-10-26 11:14:40
 - 评测机
 
- 分数
 - 0
 - 总耗时
 - 0ms
 - 峰值内存
 - 184.0 KiB