Knowledge Walls
Venkatesan
Hyderabad, Andhra Pradesh, India
Passcode:
Introduction [cont'd]
Input Output Functions [cont'd]
Structures and Unions [cont'd]
# Preprocessor [cont'd]
Scanf in Input Output Functions of Programming in C
2166 Views
Scanf Function 
Scanf function is used to read formatted output on the console. stdio.h header file contains scanf function definition.
Syntax 
scanf("read-mode1,read-mode2,read-mode3",variable-address1,variable-address2,variable-address3....variable-addressn);

How to get variable-address from variable
&variable-name;

Example:
&number1;
Program
#include
void main(){
   int a,b;
   int c;
   printf("Enter A value\n");
   scanf("%d",&a);
   printf("Enter B value\n");
   scanf("%d",&b);
   c = a + b;
   printf("C = %d",c);
}
Output 
Enter A value
12
Enter B value
22

C = 34
Next Topics
Next lessons of current book.
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Previous Topics
Previous lessons of current book.
Input Output Functions of Programming in C
Best Lessons of "Programming in C"
Top lessons which are viewed more times.
Structures and Unions of Programming in C
Input Output Functions of Programming in C
Structures and Unions of Programming in C
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details