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

Operators in C Programming

Rating
-
Sold
-
Pages
22
Uploaded on
29-07-2024
Written in
2023/2024

Notes of Unit 1 of C Programming course Notes of other modules in this course are also available Please check for other notes also

Institution
Course

Content preview

Modu

operators and expressions i

By: RISHI KU

, ➢ scanf() function to take input from the user and printf() func
display output to the user.
➢ scanf() and printf() functions are inbuilt library functions in
programming language which are available in C library by de
➢ These functions are declared and related macros are defined
“stdio.h” which is a header file in C language.
➢ We have to include “stdio.h” file as shown in all C program
use of these scanf() and printf() library functions in C languag
C Input and optional for some compilers ).
➢ Key points to remember in C scanf() and printf():
Output (I/O)
➢ scanf() is used to read the formated inputs and printf() is u
display the formatted output.
➢ scanf() and printf() functions are declared and defined in
“stdio.h” header file in C library.
➢ All syntax in C language including scanf() and printf() fu
are case sensitive.

, scanf() Function in C Language
➢ In C programming language, scanf() #include <stdio.h>
function is used to read character, string, int main()
{
numeric data from keyboard. char ch;
char str[100];
➢ scanf(“format string”, argument_list); i.e. printf("Enter any character \n");
scanf(“%format_specifier”, scanf("%c", &ch);
printf("Entered character is %c \n", ch);
&Variable_Name); printf("Enter any string ( upto 100 character ) \n")
scanf("%s", &str);
➢ Consider aside example program where printf("Entered string is %s \n", str);
user enters a character. This value is }

assigned to the variable “ch” and then ▪ The format specifier %d is used in scanf() statem
the value entered is received as an integer and %
displayed. ▪ Ampersand is used before variable name “ch” in
➢ Then, user enters a string and this value is statement as &ch.

assigned to the variable “str” and then
displayed.

Written for

Institution
Course

Document information

Uploaded on
July 29, 2024
Number of pages
22
Written in
2023/2024
Type
Class notes
Professor(s)
Rishi
Contains
All classes

Subjects

$8.99
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
mohitraj

Get to know the seller

Seller avatar
mohitraj IIT Roorkee
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
3
Last sold
-

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