READING USER INPUT

Reading User Input

Date Published:
Last Modified:

Overview

Reading user input is the process of prompting the user for input, and then receiving this by the software so that actions can be done based on what was typed. This applies more to C programs running on Linux and other terminal-capable architectures, rather than embedded microcontrollers.

Using scanf()

scanf() is one of the most common ways of getting user input from a terminal in Linux.

The simplest example is that which gets an integer displayed by the user and stores it in a variable called input.

int32_t input;
scanf ("%d", &input);

Like this page? Upvote with shurikens!

Tags:

    comments powered by Disqus