This video provides a description and example of atoi() and atof().
- [Instructor] Stdlib provides a family…of string-to-number converter functions.…Some are very simple and quick.…Some are very elaborate and slow.…Let's start with the simplest, atoi, meaning ASCII…to integer, which takes…in a string containing an integer number in base 10…or decimal and returns that integer number.…Next, we have atof, for ASCII to floating point,…which takes in a string containing a floating point number…and returns a double with that value.…
These two functions don't run many important checks…on the content of the string, so they are not very robust.…Next, we have strtol, which stands for string to long.…This one works on a string containing a series…of integer numbers, not just one, all separated…by white space characters.…That's new line, space, tab and a few more.…The function receives a string str, a pointer…to a string str_end and an integer representing the base…of the number, decimal, hexadecimal and so on.…
So it works like this.…The string is traversed, starting…at str, ignoring white space characters,…
- Working with header files
- C constants and types
- Unformatted and formatted input/output
- Accessing files with C functions
- Generating random numbers
- Converting strings
- Sorting and searching for data
- Manipulating strings
- Using mathematical functions
Skill Level Intermediate
1. The C Standard Library
2. Input and Output Library: stdio.h
3. General Purpose: stdlib.h
4. String Functions: string.h
5. Mathematical Functions: math.h
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.