Hye guys, this is what i understand things to be like so far...can someone give me some feedback?
Code:
int *arr = malloc (2);
what that does is direct a pointer to a dynamically allocated area of memory of 2 bytes in size. At this point the memory is not initialized and stil is made up of random binary content.
Then I wold go throught the memory space using a for loop and pointers:
Code:
for (int i=0; i<7; i++){
if (&arr == 1 )
counter_ones++;
else (&arr == 0 )
counter_zeros++;
*arr++;
}
printf ("There are %d ones, and %d zeros in the bytes", counter_ones, counter_zeros);