我想写一个模拟登录的程序,可是为什么两个数组地址是一样的?这该怎么操作?各位大佬求解!



代码如下:#include <stdio.h>#include <string.h>#define USER "lalala"#define PASSWORD "1234"int login(char[],char[]);void GetS(char[],int);main(){ char user[]={}; char password[]={}; printf("输入用户名:\n"); GetS(user,50); printf("输入密码:\n"); GetS(password,50); if(login(user,password)) printf("登陆成功"); else printf("用户名或密码不正确"); } int login(char user[],char password[]){ int result=0; if(strcmp(USER,user)==0&&strcmp(PASSWORD,p assword)==0) result=1; return result;}void GetS(char str[],int len){ fgets(str,len,stdin); char *find=strchr(str,'\n'); if(find) *find='\0';}