0

[SOLVED] Confusion in C scanf()

What does %10 mean here; char str[11]; scanf("%10[0-9a-zA-Z ]", str); Source: https://stackoverflow.com/a/1247993

5th Oct 2020, 10:54 AM
Bibek Oli
Bibek Oli - avatar
3 Respuestas
+ 3
The number means the maximum characters to be stored into str. Extra characters will be stored into buffer. Check the comments under the answer in the original post. They also mentioned that. https://www.sololearn.com/learn/C/2914/
5th Oct 2020, 10:59 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
CarrieForle seen but, still confused... I knew we can do that for limit the input length. But no format specifier like s, c , d, etc. used there. I don't find comment relating to this?
5th Oct 2020, 11:13 AM
Bibek Oli
Bibek Oli - avatar
+ 1
Bibek Oli AProgrammer and paxdiablo has discussed the s under the answer.
5th Oct 2020, 11:27 AM
你知道規則,我也是
你知道規則,我也是 - avatar