0

Can we use %3d in place of %d %d%d in scanf??

Please answer my question

5th Nov 2018, 3:06 PM
Sree
Sree - avatar
1 Respuesta
+ 9
Specifying the minimum width for %d format specifier has nothing to do with the number of inputs and for sure won't inform the compiler about "Hey! Make a detour by assuming the %3d means 3 integers!". Doing it the right way requires you to clearly indicate each and every of them by separate specifiers as int a, b, c; scanf("%d%d%d", &a, &b, &c);
5th Nov 2018, 3:35 PM
Babak
Babak - avatar