C Programming Language

Console Input/Output Function

Console functions are the functions to receive input from keyword and write output to VDU (Visual Display Unit).


Formatted Console I/O Function

  • These functions allows us to supply the input in a fixed format and let us obtains the output in the specified form.

  • printf()
  • The printf() function is used for formatted output.
    It prints the given statement to the console.
  • where:
    control string    indicate how many arguments follow and what their types.
    arg1,arg2,....,arg3    are the variables whose value are formatted and printed according to the specifications of the control string.



  • scanf()
  • means scan formatted
    scanf() function allows us to supply the input in a fixed format
  • where:
    control string    indicate how many arguments follow and what their types.
    arg1,arg2,....,arg3    are the variables whose value are formatted and printed according to the specifications of the control string.



  • Example:

     Video Lecture


  • sprintf()
  • sprintf() function writes the output to an array of characters.
    sprintf stands for "string printf". It does not printf display the output on screen.
    It does not printf display the output on screen.
  • where:
    control string    indicate how many arguments follow and what their types.
    arg1,arg2,....,arg3    are the variables whose value are formatted and printed according to the specifications of the control string.

    Example


  • sscanf()
  • sscanf() function reads character from a string and to control and store them in C variable according to specifified formats.
    the usage of sscanf() is as scanf(), except that the first argument is the string from which reading is to take place.


  • Example

     Video Lecture




  • Format Specifiers in C
  • The format specifier in C is used to tell the compiler about the type of data to be printed or scanned in input and output operations. They always start with a % symbol and are used in the formatted string in functions like printf(), scanf(), sprint(), sscanf(), etc..


  • The C language provides a number of format specifiers:


    Language C also provide following optional specifier:

     Video Lecture




  • Escape Sequence in C
  • The escape sequence in C language is the characters or the sequence of characters that can be used inside the string literal.
    The purpose of the escape sequence is to represent the escape sequence is to represent the character that cannot be used normally using the keyword.
  •  Video Lecture





google Ads.