我的代码非常基础,因为我对ocaml还是很陌生,我试图递归地调用一个函数,但是在函数名称上却收到了未绑定的值错误消息
let count_help x a lst = match lst with
[] -> a
| (s,i)::t -> if s = x then count_help x a+1 t else count_help x a t
;;
let count_assoc lst x =
count_help x 0 lst
;;
Run Code Online (Sandbox Code Playgroud)
错误是在count_help内调用count_help的行上的未绑定值count_help
该代码只是假设要计算给定字符x关联出现的次数
我正在使用C编程并使用gcc进行编译.每次我编译我得到一个堆栈粉碎检测到错误.这是什么意思,我该如何解决?
#include <stdio.h>
#define MAX_ARRAY 50
static int getScore(int assignmentNum[], int weight[], int daysLate[], float score[]){
int position, tempWeight, tempLate;
float tempScore;
scanf("%d %f %d %d", &position, &tempScore, &tempWeight, &tempLate);
score[position] = tempScore;
weight[position] = tempWeight;
daysLate[position] = tempLate;
assignmentNum[position] = position;
return weight[position];
}
int main(void){
int penalty_points, num_drop, num_assignment;
static int assignmentNum[MAX_ARRAY], daysLate[MAX_ARRAY], weight[MAX_ARRAY];
static float score[MAX_ARRAY];
char statGen;
int total = 0;
scanf("%d %d %s", &penalty_points, &num_drop, &statGen);
printf("%d\n", penalty_points);
while (total < 100) {
total = …Run Code Online (Sandbox Code Playgroud)