What is the difference between getchar () and getline () ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the difference between getchar () and getline () ?

And cin when we read line ?

11th Jan 2019, 1:04 PM
Zeshan Ahmed
Zeshan Ahmed - avatar
1 Answer
+ 1
This is a good answer for the gets: https://www.daniweb.com/programming/software-development/threads/444375/getline-vs-getchar string s; cin >> s; Only reads to the first whitespace character so words from the line.
11th Jan 2019, 4:29 PM
John Wells
John Wells - avatar