Ads (728x90)

scanf() Function

scanf() function is used to get the value from print screen.  Every function has return some value after execution of functions. scanf() function also has return values which was either 0 or 1. while execute scanf() function its check whether the values are correct or not. If that value is correct mean it return 1 otherwise it return 0.



example:
User input integer value but program assign character variable. In this section character variable getting integer input integer value so this statement is false, So scanf() function is return 0. because it false. 

Example Program

#include<stdio.h>
#include<conio.h>
void main ( )
{
char c ;
clrscr ( );
c=scanf( " %c" , &c );
printf("%c",c);
getch ( );
}

Explanation:


  1. Compiler first read header file after that enter main function.
  2. Scanf() function is read the input from the user. 
  3. Variable c was get the return value of scanf() function. The return value is either 0 or 1. 
  4. Printf() function will print the value either 0 or 1. Its based on return value of scanf();
  5. end of file 
If you have some suggestion then please comment below for scanf() function.

Post a Comment

  1. The best casino & sportsbook
    When looking for a good place 카라 포커 to gamble, 바카라 사이트 주소 the best casinos are those 프라하 사이트 that provide one's own cash. Most 스포츠 토토 of the 블랙 잭 만화 gambling sites will offer

    ReplyDelete