Output Input Introduction - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Sunday 5 November 2017

Output Input Introduction

Input : data provided to a program.
Output : data provided by a program.

The basic input/output function are getcharputchargetsputsscanfprintfgetchar and putchar : Single Character getchar function : Single Character Input
The getchar function returns a single character. putchar function : Single Character Output Single characters can be displayed using the putchar function.

Example of getchar and putchar :

    #include <stdio.h>
    int main( )
    {
    int c;

    printf( "Enter a single character :");
    c = getchar( );

    printf( "\nEntered Character is : ");
    putchar( c );

    return 0;
    }

Output :
Enter a single character : a
Entered Character is : a

Explanation :
When you enter a single character or string as input in getchar function, the putchar function will only going to display the first character from the entered input. Because getchar and putchar function are single character input and output function.

No comments:

Post a Comment

Post Top Ad