what is meaning of %g in c
what is meaning of %g in c
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
%g is like %f,%g use at the place of %f and cheak it
%g is not like as %f it has the large difference when you use padding.
eg.
when you use printf(” %3g “, 10/3); it gives output 3.33
here the significant digit( mentioned by padding ) are counted form the right most side of digit.
but in case of %f
eg ..
printf(” %3f “, 10/3); it gives output
3.333333
^^^
note the differece the digit before decimal is placed with in 3 character space. but when result need more compartment of spaces then it does not affect the result.
e.g..
printf(” %3f “, 10000/3); it gives output 3333.333333