C Programming - Library Functions - Discussion
Discussion Forum : Library Functions - Yes / No Questions (Q.No. 5)
5.
scanf() or atoi() function can be used to convert a string like "436" in to integer.
Answer: Option
Explanation:
scanf is a function that reads data with specified format from a given string stream source.
scanf("%d",&number);
atoi() convert string to integer.
var number;
number = atoi("string");
Discussion:
4 comments Page 1 of 1.
Maithili said:
9 years ago
How does scanf convert a string into an integer?
BOBBY said:
1 decade ago
scanf("%c",&number);//char value
scanf("%d",&number);//int value
becoz these value are stored in ASCII value...
as same is atoi()
scanf("%d",&number);//int value
becoz these value are stored in ASCII value...
as same is atoi()
Praveen said:
1 decade ago
Question is not interpreted correctly.
Ankur said:
1 decade ago
I am not able to understand how scanf is used here. Can anyone elaborate on this.?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers