The snprintf() function formats and stores a series of characters and values in the array buffer. The snprintf() function with the addition of the n argument, which indicates the maximum number of characters (including at the end of null character) to be written to buffer. It is defined in <stdio.h> header file.
int snprintf(char *str, size_t size, const char *format, ...); *str : is a buffer. size : is the maximum number of bytes (characters) that will be written to the buffer. format : C string that contains a format string that follows the same specifications as format in printf ... : the optional ( …) arguments are just the string formats like (“%d”, myint) as seen in printf.
string: geeks character count = 14
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- <iterator> library in C++ STL
- <strings> library in C++ STL
- <numeric> library in C++ STL
- <regex> library in C++ STL
- <algorithms> library in C++ STL
- SDL library in C/C++ with examples
- wprintf() and wscanf in C Library
- boost::split in C++ library
- Any datatype in C++ boost library
- Pattern Searching using C++ library
- C Library math.h functions
- Advanced C++ with boost library
- Set in C++ Standard Template Library (STL)
- Map in C++ Standard Template Library (STL)
- The C++ Standard Template Library (STL)
- difftime() C library function
- wcstof function in C library
- isgraph() C library function
- Queue in Standard Template Library (STL)
- List in C++ Standard Template Library (STL)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.