其他分享
首页 > 其他分享> > C getchar putchar and break when press escape key

C getchar putchar and break when press escape key

作者:互联网

//main.c
#include <stdio.h> void getPutChar(); main() { getPutChar(); } void getPutChar() { char c; while((int)(c=getchar())!=27) { putchar(c); } }

Compile

cc main.c -o h1

Run

./h1

 

 

 

 

//main.c

#include <stdio.h>


main()
{
   getPutChar();
}

void getPutChar()
{
    char c;
    while((c=getchar())!=27)
    {
        putchar(c);
    } 
}

 

Compile

cc main.c -o h1

Run

./h1

 

 

 

main()
{
   printChar();
}

void printChar()
{
    int c;
    c=getchar();
    while(c!=27)
    {
        putchar(c);
        c=getchar();
    }
}

 

标签:putchar,void,h1,when,break,getPutChar,main,getchar
来源: https://www.cnblogs.com/Fred1987/p/16559366.html