0

I want to know what's %g and %e format. What do they mean?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • 1
    It should all be explained in the [documentation](https://en.cppreference.com/w/c/io/fprintf#Parameters). – G.M. Jan 08 '22 at 11:15
  • 2
    [Standard C11 documentation for `fprintf()`](https://port70.net/~nsz/c/c11/n1570.html#7.21.6.1): the exact same specifiers apply to `printf()`. – pmg Jan 08 '22 at 11:16

1 Answers1

0

I assume you question refers to the string formatting syntax like it is used e. g. in printf("%g", 1.0). %g is the shortest representation of a number, and %e is the scientific number representation with the exponent in lower case.

More information about this syntax can be found here: https://www.cplusplus.com/reference/cstdio/printf/

borealis-c
  • 146
  • 1
  • 6