【发布时间】:2015-05-06 07:41:06
【问题描述】:
在编译下面的代码时,我得到了错误
"被调用的对象 strn 不是函数"
厌倦了这个错误!需要一个解决方案!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define num 400
int main()
{
char strn[num];
int count;
int a=0,e=0,i=0,o=0,u=0;
printf("enter your string!\n");
gets(strn);
for(count=0;count<strlen(strn);count++)
{
if ( strn(count)=='a' )
{
a++;
}
if (strn(count)=='e')
{
e++;
}
【问题讨论】:
-
你需要
[和]而不是(和)这里:strn(count)并使用fgets而不是gets。gets很危险,因为它不能防止缓冲区溢出
标签: c arrays function compiler-errors