Total members 11893 |It is currently Tue Nov 05, 2024 3:32 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





what is the usage of scanf function in c programming ?




Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time

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;
}

 


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : why to use scanf in c programming
 using of scanf and printf functions     -  
 ALP programming     -  
 C++ 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?     -  
 i want some help in java programming     -  
 Different Styles of Programming     -  
 Programming.PHP.2nd.Edition.zip     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com