scanf | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

scanf

I wrote two words to char array with scanf but it took only one word. Can you explain?

9th Jan 2019, 10:17 PM
Zeynep Hande Coşkun
Zeynep Hande Coşkun - avatar
1 Resposta
+ 3
Scanf will read until the first white-space character. You can try gets, even better- fgets instead. https://stackoverflow.com/questions/34007197/scanf-behaviour-for-strings-with-more-than-one-word Remember to read the official documents. āœŒļø
9th Jan 2019, 11:34 PM
dĻlĻ…Ń•ĻlĻ…Ń•
dĻlĻ…Ń•ĻlĻ…Ń• - avatar