putchar2.c

来自「c21Examples.rar」· C语言 代码 · 共 32 行

C
32
字号
/* Using putchar() to display strings. */

#include <stdio.h>

#define MAXSTRING 80

char message[] = "Displayed with putchar().";
int main( void )
{
    int count;

    for (count = 0; count < MAXSTRING; count++)
    {

        /* Look for the end of the string. When it's found, */
        /* write a newline character and exit the loop. */

        if (message[count] == '\0')
        {
            putchar('\n');
            break;
        }
        else

        /* If end of string not found, write the next character. */

            putchar(message[count]);
    }
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?