Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #339 Clear a byte array

Set all the elements of the byte array a to zero

a.fill(0);
clear(a[:])
clear(a)
import java.util.Arrays;
Arrays.fill(a, (byte)0);
FillByte(a, Length(a), 0);
import numpy
a = numpy.ones((n,), numpy.uint8)
a.fill(0)

New implementation...
< >
programming-idioms.org