Ads (728x90)

Printf() function

Printf() function was display output value on print screen. We can use printf() function as display value or display text. It accept to print the statement without any variable passing. But scanf must need some variables. I already said every function has return value. In this case printf() also has return values. Printf() return value is calculate by how much values are passing inner printf() fucntion.



example

If we pass "Welcome to Online C program" statement. Then printf() function is counted even statement has space. The total character of above statement is 26 including space. Finally printf() function return this 26 only. Because total character is 26.

Example Program

#include<stdio.h>
#include<conio.h>
void main ( )
{
int c ;
clrscr ( );
c=printf( "Welcome to Online C program" );
printf("%c",c);
getch ( );
}

Explanation:

  1. Compiler first read header file after that enter main function.
  2. printf() function is display the "Welcome to Online C program" statement on print screen . 
  3. Variable c was get the return value of printf() function. The return value is integer number or numeric number. 
  4. Printf() function will print the total counted value. Its based on return value of print() statement;
  5. Above program printf() return value is 26.
  6. end of file 
If you have some suggestion then please comment below for printf() function.

Post a Comment