Help us and donate little Bitcoins to pay the server costs: 1AXLPuRUBYc1JczTW4XS65GL6oWjNP2Vt2

User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer







because of the inhumane working conditions at amazon in Germany, I will offer the Amazon app no more! (ARD Reportage)
c:stdio.h:scanf

Table of Contents

scanf

  int scanf(const char *format, ...);

The function returns the number of items that were successfully read
EOF if the input stream reached its end, or a negative number if an error occurs.

C Sourcecode Example

/* 
 * scanf example code
 * http://code-reference.com/c/stdio.h/scanf 
 */
 
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
 
int main ( void )
{
  char input[20];
 
  printf ("Enter some Text (max 20 chars) ");
  scanf ("%s",input);  
  printf ("Scanf input was %s.\n",input);
 
  return 0;
}

output

  output: ./scanf 
  Enter some Text (max 20 chars) Hello this is a test for scanf    
  Scanf input was Hello.

see also fscanf printf fprintf

advertising
c/stdio.h/scanf.txt · Last modified: 2015/03/09 23:24 by Daniel Gohlke

The new Question & Answer System is online and waiting for your Questions about Programming problems http://ask.code-reference.com Impressum