Functions from the printf() family typically return the number of printed characters. This value can be used to determine how many characters are needed on the output medium for a given input to a format string. Depending on your C library, printf() may use an internal dynamic buffer, and memory allocation can fail. In such cases, the function returns a negative number. Therefore, we recommend to always check the return value for positivity when using it in a computation.