Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

FORMATTED AND UNFORMATTED INPUTED

Rating
-
Sold
-
Pages
6
Uploaded on
31-12-2024
Written in
2024/2025

C LANGUAGE NOTES ON ANSHUMAN SHARMA BOOK LEARN PROGRAMMING IN C

Institution
Course

Content preview

Formatted and Unformatted Input Output
Functions in C




Formatted Input/Output Functions:
Formatted I/O enables you to read or write data in a certain format.
printf()and scanf() are two examples of C functions that handle formatted I/O. The
type and format of the data to be read or written are specified by format strings,
which are used by these operations. The program's execution replaces the
placeholders for the data found in the format strings with the actual data.

➢ Why they are called Formatted I/0 Functions?

These functions are called formatted I/O functions as they can use format
specifiers in these functions. Moreover, we can format these functions
according to our needs.

Here are the list of some specifiers:

, 1. scanf()
We use the scanf() function for getting the formatted inputs or standard inputs so that
the printf() function can provide the program with numerous options of conversion.

Syntax for scanf()
scanf (format_specifier, &data_a, &data_b,……); // Here, & refers to the address
operator

The purpose of the scanf() function is to read the characters that we get from the
standard input, convert them according to the string of format specification, and then
store the available inputs in the memory slots that the other arguments represent.


2. printf()
We use the printf() function for generating the formatted outputs or standard outputs
in accordance with a format specification. The output data and the format
specification string act as the parameters of the function printf().

Syntax for printf()
printf (format_specifiers, info_a, info_b,…….. );

The character that we specify after the ‘%’ character refers to the conversion character. It is
because ‘%’ allows the conversion of any given data type into another data type for further
printing.

#include<stdio.h>
void main()
{
int a;
printf(“Enter value of a:”);

Written for

Institution
Course

Document information

Uploaded on
December 31, 2024
Number of pages
6
Written in
2024/2025
Type
Class notes
Professor(s)
Kanika jindal
Contains
Commerce 1st semester

Subjects

$26.89
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
Himanshugupta01

Get to know the seller

Seller avatar
Himanshugupta01 GUJRANWALA GURU NANAK INSTITUTE OF MANAGEMENT AND TECHNOLOGY
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
10
Last sold
-
PTU EDUCATOR

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions