Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ fill array with 0

// memset from <string.h>
memset(myarray, 0, sizeof(myarray)); // for automatically-allocated arrays
memset(myarray, 0, N*sizeof(*myarray)); // for heap-allocated arrays, where N is the number of elements
std::fill(myarray, myarray+N, 0);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #fill #array
ADD COMMENT
Topic
Name
3+4 =