小编Sta*_*der的帖子

使用递归查找数组中数字的频率

我的代码块给出了错误.但我无法在任何地方找到它

程序.它在说

第3行:在'='标记之前预期';',','或')'

 #include<stdio.h>

 int count_key1(int a[],int size,int key,int flag=0)
 {

     if(size!=0)
         {
             if(a[size-1]==key)
                 count_key1(a,size--,key,flag++);
         }
     else
        return flag;
 }
 int main()
 {
     int b[30]={1,4,2,3,2,6,6,9},key1=9,result;
     result=count_key1(b,8,key1,0);
     printf("%d is %d times present",key1,result);
     return 0;
 }
Run Code Online (Sandbox Code Playgroud)

c function parameter-passing

2
推荐指数
1
解决办法
894
查看次数

标签 统计

c ×1

function ×1

parameter-passing ×1