这个程序为什么运行不了?怎么改

img

printf("%c\n",ch); 少了一个\n,DEVC++不加\n会报错的,然后你没有主函数int main()

缺少主函数 加上就可以了

这样就可以运行了,不过不知道你这个程序意义何在?只要输入的不是h就成了死循环

#include <stdio.h>
int main()
{
    int i=0;
    char ch='\0';
    ch=getchar();
    while(ch!='h')
    {
        printf("%c",ch);
        i++;
    }
    return 0;
}