Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

why to use scanf in c programming

Thu Jul 19, 2012 4:01 pm

what is the usage of scanf function in c programming ?



Re: why to use scanf in c programming

Fri Jul 20, 2012 8:43 pm

scanf function is used to get the input data, When reading input with scanf, the input is read after the return key is pressed, but the newline generated by it will be ignored. You will need to as the reference of the variable will carry the input data :

Code:
#include<stdio.h>

int main()
{
   
int myData;

   
printf("Enter an integer:");
   
scanf("%d",&myData); // getting the data
   
printf("%d",myData);   // printing the data

   
return 0;
}

 


Post a reply
  Related Posts  to : why to use scanf in c programming
 using of scanf and printf functions     -  
 C++ programming     -  
 ALP programming     -  
 Suggest course for programming     -  
 c++ general programming     -  
 javascript programming     -  
 hello pls i want the codens in c# programming     -  
 Safe Programming     -  
 How do you know when to use the right programming language?     -  
 Java Programming help please?     -