Top "Memset" questions

memset is a C standard library function that sets the first N bytes of the block of memory to the specified value (interpreted as an unsigned char)

Why is memset() incorrectly initializing int?

Why is the output of the following program 84215045? int grid[110]; int main() { memset(grid, 5, 100 * sizeof(int)); printf("%d", grid[0]); return 0; }

c++ c memset
Linking error when building without CRT, memcpy and memset intrinsic functions

I'm trying to build an application as tiny as possible, and in doing so I'm trying to avoid use of …

c++ memcpy intrinsics crt memset
Can memset() be called with a null pointer if the size is 0?

For one reason or another, I want to hand-roll a zeroing version of malloc(). To minimize algorithmic complexity, I want …

c malloc memset
What's the use of memset() return value?

memset() is declared to return void* that is always the same value as the address passed into the function. What's …

c++ c memset
When zeroing a struct such as sockaddr_in, sockaddr_in6 and addrinfo before use, which is correct: memset, an initializer or either?

Whenever I look at real code or example socket code in books, man pages and websites, I almost always see …

c sockets memset
Initializing an integer array using memset and an int value - fails

I am writing host code for a CUDA program, so I am stuck using standard C functions. I am having …

c cuda initialization fill memset
Is there analog of memset in go?

In C++ I can initialize an array with some value using memset: const int MAX = 1000000; int is_prime[MAX] memset(…

go slice memset
What is the advantage of using memset() in C

I was curious as to whether or not there was any advantage in regards to efficiency to utilizing memset() in …

c embedded memset
Initializing entire array with memset

I have initialised the entire array with value 1 but the output is showing some garbage value. But this program works …

c++ arrays memset
Why does memset take an int instead of a char?

Why does memset take an int as the second argument instead of a char, whereas wmemset takes a wchar_t …

c memset