编程C语言问题

来源:百度知道 编辑:UC知道 时间:2024/05/17 09:00:02
请问error C2664: 'strcmp' : cannot convert parameter 1 from 'int' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast是什么意思啊?
原程序
#include <stdio.h>
#include <string.h>
#include <conio.h>
main()
{int pass[5];
int tpass[5];
int i;
for(i=0;i<5;i++)
{pass[i]=getch();
printf("*");
}
if(strcmp(pass[5],tpass[5])==0)
printf("YES");
getch();
}
写错了
tpass初使化了
tpass[5]={1,2,3,4,5}

变量类型定义错了;
应该是:char型的数组
strcmp函数要求参数为char型的,而且是数组首地址,即
char pass[5];
char tpass[5]={1,2,3,4,5};
strcmp(pass,tpass)==0

tpass 未初始化