刚学C语言向各位大神求救

如何使用’=‘来结束getchar函数??
#include
int main ()
{
int i=0,n;
char str[100];
while((str[i]=getchar())!='=')i++;
i--;
for (n=i;n>=0;n--)
printf("%c",str[n]);
return 0;
}
这是不能运行的源代码
编程要解决的问题:图片说明

用getche();

 #include<stdio.h>
#include <conio.h>
int main ()
{
    int i=0,n;
    char str[100];
    while((str[i]=getche())!='=')i++;
    i--;
    for (n=i;n>=0;n--)
        printf("%c",str[n]);
    return 0;
}

函数名: getche 功 能: 输入后立即从控制台取字符,不以回车为结束(带回显)

题主用的什么系统?
linux系统下没有getche()函数, 可调用系统命令system("stty raw")开启单个字符输入 system("stty cooked")回到整行输入,如

system("stty raw");
ch = getchar();
system("stty cooked");
需要注意的是 在打开和关闭这种模式之间 不要输出东西,因为很有可能跟你想象的不一样,如果非输不可,可以先关闭 再输出,函数结束后记得关闭。