char* askForAString(void){ char temp[16] = ""; //这里是第81行 //scanf("%s", temp); //fflush(stdin); return temp; }
char password[16] = "evlos";char inputpsw[16]; inputpsw = askForAString(); //这里是第100行if (strcmp(password, inputpsw) == 0) { printf("Allowed!"); }
projectv0.cpp: In function ‘char* askForAString()’:
projectv0.cpp:81: warning: address of local variable ‘temp’ returned
projectv0.cpp:100: error: incompatible types in assignment of ‘char*’ to ‘char [16]’
再请问 “warning: address of local variable ‘temp’ returned” 这个错误是怎么产生应该如何避免呢?
谢谢啦 =w=
动漫人物
隔江千里
慕运维8079593
相关分类