Output Functions in C Programming Language

In C programming language output functions are the functions through which the result is displayed on the standard output device like monitor.
Following are the output functions of C language –

  1. putchar( ) – This function displays the character on the screen which is already inputted by using the getchar( ) function. For ex –¬†putchar(ch); This will display the character which was stored in the variable ch.
  2. putch( ) – This function is almost similar to putchar( ) function. It is used to display only one character on the screen which is stored by using getch( ) function. It’s syntax is same as the putchar fucntion but the keyword here used is ‘ putch ‘ instead of putchar.
  3. puts( ) – It will display the whole string on the screen which user has already inputted by using the gets( ) function. It can also print the message. After printing the string or message it moves the cursor to the next line. It’s syntax is –
    puts("Text line or some message")
    You can also display some text line or message on the screen by
    using this function with the double quotes.
  4. printf( ) – This function is used to print both values of variables and messages. It can also display the character strings. The general syntax is –
    printf("control strings",v1,v2,v3);
    printf("message or text line");
    for ex -
    printf("Hello world");
    printf(" Sum of two numbers is %d",a);

    You can also use both message and format codes together as you can see in the example.

yashan has written 69 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>