编译以下代码时出现错误
"called object strn is not a function"
厌倦了这个错误!需要一个解决方案!!
#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
用作函数:strn(count)
。
您可能正在尝试访问 count
索引处的值,因此您应该使用 strn[count]
。
关于被调用的对象 'strn' 不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30070458/