比较两个字符串时出现错误 "passing argument 2 of ‘strcmp’ makes pointer from integer without a cast"

Getting error "passing argument 2 of ‘strcmp’ makes pointer from integer without a cast" comparing two strings

我是一名学生,我正在努力完成这个项目,他的 objective 是:

打印与输入请求名称相同的产品数据

每次,当我尝试编译程序时,都会出现此警告:

warning: passing argument 2 of ‘strcmp’ makes pointer from integer without a cast

#include <stdio.h>
#include <string.h>
#define N 100
#define M 8

int main (void) {
    int n;
    char name[N][M];
    char code[N][M];
    int price[N];
    char searchname;
    int i;
    int selection;
    int search, x;


    do {
        printf("Insert how many products to register: ");
        scanf("%d", &n);
    } while(n > N);

    for(i = 0; i < n; i++) {
        printf("Insert the name of the product n%d: ", i + 1);
        scanf("%s", name[i]);

        printf("Insert the code of the product registered: ");
        scanf("%s", code[i]);

        printf("Insert the price of the product registered: ");
        scanf("%d", &price[i]);
    }

    do {
        printf("Choose one of the following options:\n\n");
        printf("1) Print name and price of the searched product (code)\n");
        printf("2) Print the product that has the same name as the name inserted\n");
        printf("0) Close the program\n\n");
        printf("Type the number of the option: ");
        scanf("%d", &selection);

        switch(selezione) {
            case 1:
                x = 0;

                printf("Insert the code of the product: ");
                scanf("%d", &search);

                for(i = 0; i < n; i++) {
                    if(code[i] == search) {
                        printf("name: %s | price: %d\n\n", name[i], price[i]);

                        x = 1;
                    }
                }

                if(x == 0) {
                    printf("The searched code doesnt exist\n\n");
                }

            break;
            case 2:
                x = 0;

                printf("Insert the name to search: ");
                scanf("%s", searchname);

                for(i = 0; i < n; i++) {
                    while(strcmp(name[i], searchname) == 0) {
                        printf("Product number %d | Code: %s | Price: %d\n\n", i + 1, code[i], price[i]);
                        x++;
                    }
                }

                if(x == 0) {
                    printf("There are no products with this name\n\n");
                }

            break;
            case 0:
            break;
            default:
                printf("This option doesnt exist");
            break;
        }
    } while(selection!= 0);

    return 0;
}

我搜索了一段时间堆栈溢出,提到这个问题的帖子没有帮助。
我想做的是将字符串 name[i]searchname 进行比较,后者也是一个字符串。
我在这里遗漏了什么吗?

What im trying to do, is compare the string name[i] with searchname which is a string too.

char searchname; - 看起来不像字符串。 – Eugene Sh.

你可以试试char searchname[100];…… – 风向标