liveBook · Manning

Sprintf

A formatted-output function or operation that converts supplied values according to a format specification and produces formatted character data.

How 2 Manning books explain it

Modern C

sprintf is a C standard library function that formats output into a character array without providing a destination-size bound.

How it is used
Formats numbers and other values into a character array while constructing text in memory.
How deep it goes
Explains formatting, termination, return length, and overflow risk, while deferring bounded construction to snprintf.
Examples
Demonstrates sprintnumbers, repeated number formatting, separator copying, and the format string "%#zX".
What you can do after
Apply it via the C standard library while recognizing when bounded formatting is required.

Read how Modern C explains sprintf →

Modern C, Third Edition

sprintf is a C standard-library function that formats converted values into a character array without imposing a destination-size limit.

How it is used
Formats parsed numbers into a string while advancing a destination-buffer pointer.
How deep it goes
Explains formatting, termination, return length, and overflow risk, then defers bounded output to snprintf.
Examples
Uses sprintnumbers to format numbers, insert separators, advance a buffer pointer, and append a newline.
What you can do after
Apply sprintf when the destination capacity is already known, and select snprintf for unknown-length output.

Read how Modern C, Third Edition explains sprintf →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.