I intend to names as part of my output when i input it but am getting something strange PLEASE HELP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I intend to names as part of my output when i input it but am getting something strange PLEASE HELP

#include <stdio.h> int main() { int x, y; char whatsyourname [20]; scanf("%10d %8d %*f %10s", &x, &y, whatsyourname); printf("%d %d %s", x, y, whatsyourname); //its not putting the names i input //why please i am not getting it pls return 0; }

15th Jun 2019, 10:34 PM
Haramide Damilola DATABEAM
Haramide Damilola DATABEAM - avatar
1 Answer
+ 3
scanf will not read white space which I think you included in the name, you can use gets or fgets function for that
15th Jun 2019, 11:41 PM
✳AsterisK✳
✳AsterisK✳ - avatar