Join Eduardo Corpeño for an in-depth discussion in this video Formatted I/O example, part of C Standard Library.
- [Instructor] Now let me write some code…for another very basic echo application,…which will take in all of the variables…you see in the main function.…I will do that for a specific format…on each of the variables, and I will print them…all out in the same specific format.…I will do that with scanf and printf.…So let's get started.…First, remember that scanf receives two arguments.…First, the format string, and then a list of variables,…which will take in all of the values…coming from the standard input.…
So the string will only contain format specifiers…separated by spaces.…So let's start with the integer value…and the spaces I enter in this string…are interpreted by scanf as white spaces.…So this applies for any number of spaces in the input…or new line characters.…Next, let's specify the character.…Next the floating point number, next the double variable,…which is long floating point.…
And now let me do something very nice for this string.…So the specifier for a string is percentage S,…but I can specify that I want it to take in…
- 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.