The input - output is performed through set of library functions , that are supplied with every C compiler. If a program uses any function from standard input /output library, then it should include the header file <stdio.h> .
Conversion specification character : scanf() and printf() make use of conversion specification character to specify the the type and size of data . It must begin with % .
Ex. %d for integer
%c for single character constant
%s for string
Reading input data :
scanf( ) library function
scanf( " Control String", address 1, address 2, ..... ,address n);
scanf() should have at least two parameters :- 1) Control string 2) Address . Control string contains conversion specification character . It should be written within double quotes. Conversion specification character may be one or more . It depends on number of values we want to input but at least one address should be present. Address of variable is found by preceding the variable by an & sign. & is address of operator which gives starting address of variable name in memory. It should be noted that a sting variable is not preceded by an &.
void main( )
{
int z;
..........
scanf( " %d", &z);
..........................
..........................
}
Writing output data :
printf( ) library function
printf( " Control String", variable 1, variable 2, ..... ,variable n);
Control string contains conversion specification character or text or both. If the control string does not contain any conversion specification,then variable names are not specified . The name of variable should not be preceded by an & sign.
#include <stdio.h>
void main( )
{
int a;
printf("Enter Number : \n");
scanf( "%d", &a);
printf(" Number = %d",a);
}
2 Comments
I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Anyway, I’ll be subscribing to your feed and I hope you post again soon.Python Online Training
ReplyDeleteLearn Python Online
Your site is amazing and your blogs are informative and knowledgeable to my websites.This is one of the best tips in my life. I have in quite some time.Nicely written and great info.Thanks to share the more information's.
ReplyDeleteSalesforce Training in Chennai | Certification | Online Course | Salesforce Training in Bangalore | Certification | Online Course | Salesforce Training in Hyderabad | Certification | Online Course | Salesforce Training in Pune | Certification | Online Course | Salesforce Online Training | Salesforce Training