Can someone please explain these errors? I don't have a multidimensional array so I don't understand how I'm getting this error.

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




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);
    }
}

program accepts big_boy_counter and lower_bound_of_big_boy_counter as int*. You then pass the address of those to declaration_list, which makes them both int**. But declaration_list also expects int*, which means you're passing a value of incompatible type.

This article has been dead for over six months. Start a new discussion instead.