Outputs a single character - C Data Type

C examples for Data Type:char

Description

Outputs a single character

Demo Code

#include <stdio.h>
#include <string.h>

int main()/*from   w w w  . j av a  2  s.  co m*/
{
    int i;
    char msg[] = "book2s.com";
    for (i = 0; i < strlen(msg); i++)
    {
        putchar(msg[i]); //Outputs a single character
    }

    putchar('\n'); // One line break after the loop is done.

    return(0);
}

Result


Related Tutorials