很抱歉这个可能很荒谬和基本的问题(我从十几岁开始就没有用 C 编程,现在我 39 岁了......),但是通过下面的代码,我得到了 tcc 编译器的输出:
test.c:15: warning: assignment makes pointer from integer without a cast
test.c:26: error: lvalue expected
为什么会发生在第 26 行?
感谢您的耐心等待,我这几天主要做web前端和后端的东西......
- - - 代码 - - -
#include <stdio.h>
// needed for gets() and puts()
char* input() {
char inp[256];
gets(inp);
return inp;
}
void output(outp) {
puts(outp);
}
int main() {
int exe = 1;
char inp[256];
char exit_msg[] = "END OF PROGRAM. THANK YOU!\0";
while(exe) {
inp = input(); // line 26
output(inp);
if (inp == "END"){
exe = 0;
}
}
puts(exit_msg);
return 0;
}