Help! I need to reallocating memory then set the entire/partial buffer into specific value.
calloc only works for allocating memory, not reallocating memory
and memset only works for char data type... T_T...
Should I do:
Or any std function out there?Code:buffer <- malloc(5) for i <- 0 to 4 buffer[i] <- 2 end for ; do something with buffer[i] buffer <- realloc(10) for i <- 5 to 9 buffer[i] <- 2 end for
Btw, we should prefer to use std function instead of our function because they are faster sometime.