Chapter-3 (Input/Output functions in C) | Code2night.com
Code2night
  • Home
  • Blogs
  • Guest Posts
  • Tutorial
  • Post Blog
  • Register
  • Login
  1. Home
  2. Blogpost

Chapter-3 (Input/Output functions in C)

Date- Dec 09,2023

1627

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.

Comments

Tags

LinkedinLogin
LinkedinProfile
GetLinkedinProfile
C#
Aspnet
MVC
Linkedin
ITextSharp
Export to Pdf
AspNet Core
AspNet
View to Pdf in Aspnet
Model Validation In ASPNET Core MVC 60
Model Validation
Model Validation In ASPNET Core MVC
Model Validation In ASPNET
Image Compression in AspNet
Compress Image in c#
AspNet MVC
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 | 1210
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 Join Us On Facebook

Welcome To Code2night, A common place for sharing your programming knowledge,Blogs and Videos

  • Panipat
  • info@Code2night.com

Links

  • Home
  • Blogs
  • Tutorial
  • Post Blog

Popular Tags

Copyright © 2025 by Code2night. All Rights Reserved

  • Home
  • Blog
  • Login
  • SignUp
  • Contact
  • Terms & Conditions
  • Refund Policy
  • About Us
  • Privacy Policy
  • Json Beautifier
  • Guest Posts