谁能解释一下这些错误吗?我没有多维数组,所以我不明白我是如何得到这个错误的。
main.c:291: warning: passing argument 2 of ‘type_specifier’ from incompatible pointer type
main.c:263: note: expected ‘int *’ but argument is of type ‘int **’
main.c:291: warning: passing argument 3 of ‘type_specifier’ from incompatible pointer type这是我的密码。我从main调用program(),然后尝试从program()调用declaration_list()。
void declaration_list(char *strings_line_tokens[], int *big_boy_counter, int *lower_bound_of_big_boy_counter)
{
int cmp_str1 = 0;
int cmp_str2 = 0;
int cmp_str3 = 0;
printf("declaration_list().\n");
cmp_str1 = strcmp("int", strings_line_tokens[*lower_bound_of_big_boy_counter]);
cmp_str2 = strcmp("float", strings_line_tokens[*lower_bound_of_big_boy_counter]);
cmp_str3 = strcmp("void", strings_line_tokens[*lower_bound_of_big_boy_counter]);
if(cmp_str1 == 0 || cmp_str2 == 0 || cmp_str3 == 0)
{
declaration(strings_line_tokens, &big_boy_counter, &lower_bound_of_big_boy_counter);
}
//declaration_prime();
//declaration_list();
}
void program(char *strings_line_tokens[], int *big_boy_counter, int *lower_bound_of_big_boy_counter)
{
int cmp_str1 = 0;
int cmp_str2 = 0;
int cmp_str3 = 0;
printf("In program().\n");
cmp_str1 = strcmp("int", strings_line_tokens[*lower_bound_of_big_boy_counter]);
cmp_str2 = strcmp("float", strings_line_tokens[*lower_bound_of_big_boy_counter]);
cmp_str3 = strcmp("void", strings_line_tokens[*lower_bound_of_big_boy_counter]);
if(cmp_str1 == 0 || cmp_str2 == 0 || cmp_str3 == 0)
{
declaration_list(strings_line_tokens, &big_boy_counter, &lower_bound_of_big_boy_counter);
}
}发布于 2015-10-10 10:49:21
declaration_list(strings_line_tokens, &big_boy_counter, &lower_bound_of_big_boy_counter);在这个big_boy_counter中已经是一个int *,但是您传递它的地址。但是函数需要一个int *。
还有第三个参数,您需要传递int *,但lower_bound_of_big_boy_counter也是int *,您传递它的地址。
在函数调用中把big_boy_counter和lower_bound_of_big_boy_counter传递给它。就像这样-
declaration_list(strings_line_tokens, big_boy_counter, lower_bound_of_big_boy_counter);https://stackoverflow.com/questions/33053108
复制相似问题