Width vs Precision. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Width vs Precision.

Can someone please explain to me the difference between width and precision in his/her own terms. Appreciated.

26th Jul 2019, 6:51 AM
Thomas Oyaro
Thomas Oyaro - avatar
1 Réponse
+ 1
Are you referring to the format in printf function? If so, width is the minimal number of characters to be printed, while precision is the is the number of digits to be printed after the decimal point. You can refer to http://www.cplusplus.com/reference/cstdio/printf/
26th Jul 2019, 7:15 AM
Agent_I
Agent_I - avatar