INTRODUCTION Every language has some features that provides interaction between the program and the user of the program. C language uses the reference.

Slides:



Advertisements
Similar presentations
Character Arrays (Single-Dimensional Arrays) A char data type is needed to hold a single character. To store a string we have to use a single-dimensional.
Advertisements

Lecture 2 Introduction to C Programming
Introduction to C Programming
1 CSE1301 Computer Programming: Lecture 9 Input/Output.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 6P. 1Winter Quarter I/O in C Lecture 6.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
A simple C program: Printing a line of text #include main() { printf(“hello, world\n”); } Program output: hello, world.
Console and File I/O - Basics Rudra Dutta CSC Spring 2007, Section 001.
C - Input & Output When we are saying Input that means to feed some data into program. This can be given in the form of file or from command line. C programming.
CS 161 Introduction to Programming and Problem Solving Chapter 13 Console IO Herbert G. Mayer, PSU Status 9/8/2014 Initial content copied verbatim from.
Chapter 18 I/O in C. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Standard C Library I/O commands.
Input/Output  Input/Output operations are performed using input/output functions  Common input/output functions are provided as part of C’s standard.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 9 - Formatted Input/Output Outline 9.1Introduction 9.2Streams 9.3Formatting Output with printf.
CMPE13 Cyrus Bazeghi Chapter 18 I/O in C. CMPE Standard C Library I/O commands are not included as part of the C language. Instead, they are part.
Chapter 5: Data Input and Output Department of Computer Science Foundation Year Program Umm Alqura University, Makkah Computer Programming Skills
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
Standard Input and Output. Overview Data communication with a C program and the outside world is performed through files Files are a non-volatile way.
Yu Yuanming CSCI2100B Data Structures Tutorial 3
Reading the data from the input devices and displaying the results on the screen are the two main tasks of any program. To perform these tasks user friendly.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
CHAPTER 2 PART #3 INPUT - OUTPUT 1 st semester King Saud University College of Applied studies and Community Service Csc
Chapter 18 I/O in C.
Introduction to C Programming Chapter 2 : Data Input, Processing and Output.
C Programming Lecture 5 : Basic standard I/O Lecture notes : courtesy of Ohio Supercomputing Center, science and technolgy support.
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
CSC141 Introduction to Computer Programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture - 6.
CSE1301 Computer Programming: Lecture 6 Input/Output.
Sudeshna Sarkar, IIT Kharagpur 1 I/O in C + Misc Lecture –
CSCI 130 Basic Input and Output Chapter 9. The printf ( ) function Printf(“\nThe value of x is %d”, x); Displayed to screen (assume x = 12): –The value.
CCSA 221 Programming in C INPUT AND OUTPUT OPERATIONS IN C – PART 1 1.
Chapter 18 I/O in C Original slides from Gregory Byrd, North Carolina State University Modified slides by C. Wilcox, Y. Malaiya Colorado State University.
Introduction to Computing Lecture 03: Basic input / output operations Introduction to Computing Lecture 03: Basic input / output operations Assist.Prof.Dr.
C Formatted Input/Output
Zhang Hongyi CSCI2100B Data Structures Tutorial 3
Chapter 7 Text Input/Output Objectives
Chapter 7 Text Input/Output Objectives
INC 161 , CPE 100 Computer Programming
Chapter 2 - Introduction to C Programming
Chapter 7 Text Input/Output Objectives
Unit-4, Chapter-2 Managing Input and Output Operations
Module 7: Input/Output Operations ITEI102 Introduction to Programming
Chapter 18 I/O in C.
Plan for the Day: I/O (beyond scanf and printf)
I/O in C + Misc Lecture Sudeshna Sarkar, IIT Kharagpur.
Chapter 2 - Introduction to C Programming
Programming in C Input / Output.
Input and Output Lecture 4.
Input/Output Input/Output operations are performed using input/output functions Common input/output functions are provided as part of C’s standard input/output.
C Formatted Input / Output Review and Lab Assignments
CSI 121 Structured Programming Language Lecture 7: Input/Output
توابع ورودي-خروجي.
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
CSCE 206 Lab Structured Programming in C
Chapter 2 - Introduction to C Programming
Computer Science Department
Chapter 18 I/O in C.
Chapter 2 - Introduction to C Programming
Chapter 18 I/O in C.
Chapter 4 Managing Input and Output Operations
Introduction to C Programming
Chapter 2 - Introduction to C Programming
CSCE 206 Lab Structured Programming in C
Introduction to C Programming
C Characters and Strings
Getting Started With Coding
Chapter 18 I/O in C.
Introduction to C Programming
Presentation transcript:

INTRODUCTION Every language has some features that provides interaction between the program and the user of the program. C language uses the reference stdin for standard input devices and stdout for standard output devices. I/O FUNCTIONS

I/O FUNCTIONS

C language does not support or provide any input/output operations as a part of language,but the operations are provided as library functions . The input/output functions of C language are provided through the header file stdio.h Definations of various I/O functions is stored in the stdio.h header files. I/O FUNCTIONS

Various I/O functions printf() scanf() getchar() putchar() gets() puts() I/O FUNCTIONS

printf Function The printf function writes output to stdout Ex. printf("Average: %d \n“,Average); The first argument is a character string containing ordinary text, escape characters, and format specifiers. The escape character \n is used in the given line for newline. The order, number, and type of the format specifiers corresponds to the order, number, and type of the arguments in the printf call I/O FUNCTIONS

printf Examples No format specifiers, one escape character, no other arguments printf("Name Age Address Distance\n"); One format specifier, two arguments printf("Results is %d\n", theResult); Four format specifiers, five arguments printf("%c %d %f %s", aCharacter, anInteger, aFloat, aString); I/O FUNCTIONS

scanf Function The scanf function reads input from stdin scanf(“number is %d", &Number); The first argument is a character string containing one or more conversion specifiers Each argument value must be represented by the address of the variable, NOT the variable itself, where the value should be stored To designate the address for a character, integer, structure, or floating point variable, precede the variable name by the & operator, which means "address of“. I/O FUNCTIONS

scanf Examples One format specifier. scanf("%d", &theResult); Three format specifiers, four arguments scanf("%d%f%s", &anInteger, &aFloat, aString); Same as above, but in a different order scanf("%s %f %d", aString, &aFloat, &anInteger);  I/O FUNCTIONS

Examples of Putchar Syntax of Putchar- putchar(charcter_variable) For examples char c = ‘a’; Will display ‘a’ on the output screen. I/O FUNCTIONS

Examples of Getchar Syntax Character_variable =getchar(); Where character_variable is a char type of variable.for exampe Char c; c= getchar(); Will store the ASCII value of the key pressed. I/O FUNCTIONS

Your Queries please.. I/O FUNCTIONS