字符串中的错误执行时

Aay*_*rma -1 c

char str[6];

do
{
    printf("Enter the string you wanna check:");
    scanf("%s", str);

}
while(str != "exit");
Run Code Online (Sandbox Code Playgroud)

为什么这不起作用?

Lee*_*ker 5

str永远相等"exit",因为你比较两个内存不同部分的地址.您可能希望比较字符串的内容,其中有一个函数strcmp().