What is being stored inside int* end in this statement? ----> int* end = array + 8;
I'm guessing that it's the memory address since I tried printing out the content inside *end, and the value printed changes every time I run the program. array gives the address, and the + 8 gives it 8 storage locations?
I'm guessing that it's the memory address since I tried printing out the content inside *end, and the value printed changes every time I run the program. array gives the address, and the + 8 gives it 8 storage locations?
Code:
int array[8];
array[0] = 10;
// get and print size of the array
int size = sizeof(array) / sizeof(array[0]);
printf("Size is %d\n", size);
// this is accessing some address because the value stored inside end changes every time we run the program?
int* end = array + 8;
for (int* elem = array; elem < end; ++elem) {
*elem = 6;
} // end of for loop
// print contents inside the array
for (int i = 0; i < size; i++) {
printf("%d\n", array[i]);
} // end of for loop