这是我在数组中查找最常用字符的代码。请调试它并找出错误。它大部分时间都在工作,但在某些情况下输出不正确。请在这件事上给予我帮助
#include <stdio.h>
#define size 100
int main()
{
char a[size]={0};
int i,j, k, n;
char c, e;
printf("enter size of array\n");
scanf("%d", &n);
a[n]=0;
printf("enter the characters??\n");
for(i=0; i<n; i++)
{
scanf(" %c", & a[i]);
}
for(j=0; j<n; j++)
{
for(k=0; k<n; k++)
{
if(j==k)
{
continue;
}
else if(a[j]=a[i])
{
e=a[j];
}
else if(a[j]!=a[k])
{
continue;
}
}
}
printf("the most frequently occuring character is %c", e);
return 0;
}