Login Register
Code2night
  • Home
  • Guest Posts
  • Blog Archive
  • Tutorial
  • Languages
    • Angular
    • C
    • c#
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • Security
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
    • Word Counter
    • Base64 Encode/Decode
    • Diff Checker
    • JSON to CSV
    • Password Generator
    • SEO Analyzer
  1. Home
  2. Blog
  3. Chapter-3 (Input/Output functions in C)

Chapter-3 (Input/Output functions in C)

Date- Dec 09,2023

3316

In C, input and output functions are used to interact with the user and the external world. These functions allow you to read data from the user or files and write data to the screen or files. The standard library provides several functions for input and output. Here are some of the most commonly used input and output functions in C:

Input Functions:-

  1. scanf: Used for reading input from the standard input (usually the keyboard) or files based on a specified format.
     
     Example
     int num;
    scanf("%d", &num);
     
     It is used to input the data from User



  2. getchar and getch: Used for reading a single character from the standard input. getch is a non-standard function often used for console-based input without echoing characters.
     
     Example
     char ch = getchar();
     
     
  3. gets (deprecated): Used to read a string from the standard input. However, it's considered unsafe and is deprecated in favor of fgets.

Output Functions:-

  1. printf: Used for formatted output to the standard output (usually the console) or files.
     
     Example
     int num = 42;
    printf("The value of num is %d\n", num);
    It is used to print the content on Screen.
     
     
  2. putchar: Used for writing a single character to the standard output.
     
     Example
     char ch = 'A';
    putchar(ch);
     
     
  3. puts: Used to write a string to the standard output followed by a newline character.
     
     Example
    char str[] = "Hello, World!";
    puts(str);
    
     
     

These are some of the basic input and output functions in C. It's important to handle errors and check return values when using file-related functions, as file operations can fail for various reasons (e.g., file not found, insufficient permissions). Additionally, remember to include the necessary header files ( for standard I/O) at the beginning of your C programs when using these functions.

S
Shubham Saini
Programming author at Code2Night — sharing tutorials on ASP.NET, C#, and more.
View all posts →

Related Articles

Unconditional statements in C
Sep 21, 2023
What is C?
Dec 31, 2022
Swich Statement in C
Sep 23, 2023
2-D Array in C
Sep 25, 2023

Comments

Contents

More in C

  • Chapter-1 (Introduction of C) 3518 views
  • Check if the character is a vowel or a consonant. 3476 views
  • Chapter-5 (format specifier in c) 3386 views
  • Chapter-4 (Operators in C) 3141 views
  • Assigment-folder(To find the biggest number in a 1D array in… 3076 views
View all C posts →

Tags

AspNet C# programming AspNet MVC c programming AspNet Core C software development tutorial MVC memory management Paypal coding coding best practices data structures programming tutorial tutorials object oriented programming Slick Slider StripeNet
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blog Archive
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
  • SEO Analyzer
Free Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Diff Checker
  • Base64 Encode/Decode
  • Word Counter
  • SEO Analyzer
By Language
  • Angular
  • C
  • c#
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • Security
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ·  Terms
Translate Page