C printf function to output message

Description

printf function displays information on screen and returns the number of characters printed.

Example

The following code uses printf to output message to the screen.


#include <stdio.h>
/*from   ww  w . jav  a 2  s . com*/
main(){
    int i = 0;

    i=printf("abcde\n");

    printf("total characters printed %d\n",i);
}

The code above generates the following result.

printf can display variables by using the % conversion character.





















Home »
  C Language »
    Input / Output »




printf
scanf