Skip to content
Sign in
Anti Corruption Establishment Department PPSC

The function sprintf() works like printf(), but operates on:

Tap an option to check the answer. You can also press A–D.

Explanation
In C, sprintf() formats data like printf(), but instead of printing to the screen it writes the formatted output into a string (character array) in memory. Related facts: printf() displays output on the standard output (screen).sprintf() stores the formatted result in a string buffer.fprintf() writes formatted output to a file. Exam tip: Remember: the 's' in sprintf stands for string, just as 'f' in fprintf stands for file.