printf的几点新发现

1、关于printf的缓存刷新问题。

https://blog.csdn.net/h___q/article/details/82469598

将待打印的内容放入缓冲区中,刷新之后就能打印出来。

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
    char ch;

    scanf("%c",&ch);

    while (ch != 'g') {
        printf("%c", ch);
        scanf("%c", &ch);
    }

    return 0;
}

在输入队列中依次读取,之后连续打印出来。

结果页面如下,

猜你喜欢

转载自www.cnblogs.com/awheat/p/12183000.html