SubmenuAdvertiseWallpapersSubmit News




 


Log in Problems?
New User? Sign Up!

C Programming and the printf and scanf Family of Functions

Newsimage Posted by hevans66 on Sunday, August 23, 2009

Programming in C can be a daunting task for a beginner, especially when new programming languages like Python make it so easy to accomplish basic tasks. Taking input from the user, and displaying data back to the user in a human readable format is one of those things in C that can be tricky if you haven't done it before.

This idea of displaying and reading data in human readable formats becomes especially important in embedded electronics since there often many different ways in which data is represented to the user (over LCDs, or through serial ports). Many times we even use these common input output ideas to transfer data from microcontrollers to PC computer programs, or between different embedded systems.

Luckily, the standard C programming library provides the printf and scanf family of functions that can be used to easliy turn data into human readable strings, or strings into common data structures. In this tutorial, we go over the basics of the printf and scanf functions, and how they are commonly used. We include an easy to follow tutorial that applies to both microcontroller programming, as well as regular computer programming, as well as source code and plenty of examples.