I am trying to initialize a bitmap to all bits on. My idea was to initialize an array of the buffer size and then use memcpy
; however:
#include <stdio.h>
#define SIZE 5
int main () {
int i[SIZE] = { ~0 };
for (int j = 0 ; j < SIZE ; j++) {
printf("%d\n", i[j]);
}
return 0;
}
results in:
-1
0
0
0
0
my expectation was that I would see all -1
. Why does this not work, and how can I accomplish my goal?