I'm learning C and I want to know how the getchar and gets functions operate.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm learning C and I want to know how the getchar and gets functions operate..

7th Jan 2022, 3:21 PM
Mackleode
Mackleode - avatar
4 Answers
+ 1
Martin Taylor good to know. The sololearn course on C uses it.
8th Jan 2022, 3:24 AM
Simon Sauter
Simon Sauter - avatar
0
Getchar gets only one character. Gets gets string(array of chars) to the moment you press space edit gets get string with spaces Mackleode
7th Jan 2022, 4:12 PM
Bartek
0
Martin Taylor, if I should not use gets which function should I use scanf or fgets.
9th Jan 2022, 1:49 PM
Mackleode
Mackleode - avatar
0
You should use fgets when you want string with spaces else use scanf
9th Jan 2022, 4:07 PM
Bartek