O'Reilly logo

C by Nikolaos D. Tselikas, George S. Tselikis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3

Getting Input with scanf()

This chapter focuses on using the scanf() function to get input from a user, store that input in variables, and use it in your programs. scanf() is a powerful function that offers many ways to read and store data in program variables. We won’t cover every aspect of using scanf() but we’ll give you enough of what you need in order to use it to read data. In this chapter, we’ll mainly use scanf() to read numeric data and store that data in numeric variables. You’ll see other uses of scanf() over the next chapters. Just remember as you read that scanf() is not an easy function to use; it contains several traps, so use it with great care.

scanf() Function

scanf() function is used to read data from the standard ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required