sscanf()
This function works the same as the C scanf Function but instead of inserting the input string from the terminal it has to be passed as the first parameter
Syntax:
The scanf()
function takes two arguments:
1. C Strings: a sting as a variable or a constant (“example of a constant”)
2. the C Format Specifiers of the variable
3. the C Variables where the input will be saved
Single Input
Nota: if the input is not accepted, the variable won’t be saved
Multiple Input
The sscanf()
function also allow multiple inputs (an integer and a character in the following example):
oss: you can specify the input text
Nota: if the input is not accepted, the variable won’t be saved
[! warning] Note: it’s better to not insert spaces inside the scanf syntax