I am allocating 4 bytes of memory using calloc
.
Now i need more 4 bytes, So i use realloc
. But for newly allocated memory block of 4 bytes i need to initialize the memory to 0
Asked
Active
Viewed 71 times
1

kiran Biradar
- 12,700
- 3
- 19
- 44

Kirti Kedia
- 133
- 6
-
5`memset` would be one way - http://man7.org/linux/man-pages/man3/memset.3.html `memset(p+4, 0, 4)` – Support Ukraine Nov 15 '19 at 11:45
-
C or C++, please pick one. – moooeeeep Nov 15 '19 at 11:47
-
2If `C++` you should not be using `malloc` and friends. – kiran Biradar Nov 15 '19 at 11:52