I try to fill a 2D array with 1 using memset.
int arr[3][3];
memset(arr,1,sizeof(arr));
Result :
16843009 16843009 16843009
16843009 16843009 16843009
16843009 16843009 16843009
memset
works on the byte level without regards to other step sizes. Your int
is 4 bytes large and thus each of those bytes are set to 00000001b
, and therefore
00000001000000010000000100000001b = 16843009