Set buffer with specific value using memset in C - Example of memset()
In this C program, we will learn how to set a particular value to the buffer (character array)? To set the value to the buffer, we will use memset() function.
This C program will demonstrate use of memset(), in this code snippet we will learn how to set specific value using memset() to the buffer.
memset() is a library function of string.h header file which assigns given value to the given number of bytes (characters).
Set buffer (character array) with specific value in C
Output
buffer: buffer (memset with space): . buffer (memset with x): xxxxxxxxx. buffer (memset with value 15): . buffer (memset with value 15 printing integer values: *** LAST VALUE WILL BE NULL ***): 15 15 15 15 15 15 15 15 15 00 .
need an explanation for this answer? contact us directly to get an explanation for this answer