prompt for a number of characters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

prompt for a number of characters

Is it possible to prompt for a specific number of characters?

17th Jan 2020, 5:04 PM
Gwlanbzh
Gwlanbzh - avatar
4 Answers
+ 2
char name[100]; scanf("%10s", name); //the "10" means ten (max)characters printf("%s", name); http://www.cplusplus.com/reference/cstdio/scanf/
17th Jan 2020, 6:45 PM
rodwynnejones
rodwynnejones - avatar
+ 3
I didn't get the question either sorry
17th Jan 2020, 5:07 PM
Half
Half - avatar
+ 1
Elaborate more please, an example?
17th Jan 2020, 5:05 PM
Ipang
+ 1
Sht sorry unread the your post and I thought you meant py, sont know c sorry my bad
18th Jan 2020, 3:35 PM
Half
Half - avatar