TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    C Tutorials

    C scanf Function

    Overview

    The C scanf function is a standard library function. The Standard Input/Output Library contains functions for formatted data transfer in and out of the C program. The two such functions are as follows:

    • printf (print formatted) function
    • scanf (scan formatted) function

    The data printing and reading functions are defined as standard functions which are part of
    the language specification but are not part of the C Language itself. The functions are defined in the system header file stdio.h

    scanf Function

    The C scanf function is a standard library function to read data from the standard input. This function is the counterpart of the printf function.

    The scanf() function reads input from stdin, according to the given format, and stores the data in the other arguments.

    Syntax

    The general syntax of the scanf function is:

    scanf(format, arg1,arg2,…);

    The format string contains the conversion specifications. The arguments should be pointers to indicate where the input should be stored.

    Examples

    Read an Integer

    To read an integer and store it into an integer variable called a number.

    scanf(“%d”,&number);

    The & is the ‘address of‘ operator in the C language. The &number returns the address of the variable number.

    Read float Number

    In this example, we will use the scanf function to read data into float variable length.

    scanf(“%f”,&length);

    C scanf Function

    Related Posts

    C Language Characteristics

    C Tutorials /

    C Language Characteristics

    C Source Code .c File

    C Tutorials /

    C Program Files & Formats

    GNU Compiler Collection GCC

    C Tutorials /

    C Compilers

    C Pointers

    C Tutorials /

    C Pointers

    C Tutorials /

    C Two-Dimensional Arrays

    ‹ C for loop statement› C Programming Cycle

    Recent Posts

    • Running Tests in Parallel with Selenium Grid
    • Advanced Selenium Features
    • Locating Web Elements
    • Running the Test Script
    • Writing Your First Selenium Test Script
    • Getting Started with Selenium Automation Testing
    • Setting Up the Environment
    • How can you monitor the Quality Assurance Audit?
    • Leveraging LambdaTest with Appium 2.0
    • Appium 2.0 Plugins ListAppium 2.0 Plugins
    • Touch Actions and Multi-Touch Actions
    • Changes in Drivers and Classes
    • Appium Inspector
    • Capabilities in Appium 2.0
    • Appium 2.0 Driver ListAppium 2.0 Driver Installation & Management
    CyberLink Multimedia Software

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com