0

scanf("%2d %d %*f %5s", &x, &y, text); /* input: 1234 5.7 elephant */ printf("%d %d %s", x, y, text); /* output: 12 34

Please explain it

14th Sep 2020, 12:57 AM
Asad Zaman
Asad Zaman - avatar
7 Answers
+ 2
Asad Zaman, The <text> variable will store only 5 characters of the given input string. So it contains 'eleph', and the output will be 12 34 eleph
14th Sep 2020, 5:27 AM
Ipang
+ 2
Martin, That one was for the OP ☝ I did mention him ...
14th Sep 2020, 10:13 AM
Ipang
0
I'm asking about our input is 1234,5.7 and elephand But where has gone 5.7 and what is %*f Sorry for my english
14th Sep 2020, 1:25 PM
Asad Zaman
Asad Zaman - avatar
0
Thank you Martin Taylor
15th Sep 2020, 1:28 PM
Asad Zaman
Asad Zaman - avatar