Char array new form ?

What does it mean when the char array is used in this form Char array[1<<19];
Can someone please help? Thanks :)
closed account (3hM2Nwbp)
You're creating an array of 2^19 elements. (decimal 1 shifted 19 bits to the left)

* Think I ninja'd quirky. :P
Last edited on
that's called bitshifting, 1<<19 shifts the bits in the number 1 to the left by 19, which is equivalent to (1*(2^19)).

EDIT - the >> operator works the other way so it shifts the bits to the right and halves the number with each shift, bear in mind though that it shifts the binary bits so if you shifted the number 3 to the right by 1 you end up with 1, not with 1.5, you cant use it for fractions it just works in powers of 2
Last edited on
Thankss ^_^
Topic archived. No new replies allowed.