So I have this array in a header file like this:
// header.h
static const unsigned int array1[]={0x00,0x01,0x02,0x03};
And:
// file.c
main()
{
unsigned int *ptrToArray;
ptrArray = &array1[0];
}
Correct me if I am wrong. I assume: to find the number of bytes of array elements, instead of sizeof(array1)
the equivalent will be sizeof(*ptrArray)
, right?
And to access the elements of the array, instead of array[i]
, it will now be:
*(ptrArray)
for the first element,*(ptrArray+1)
for the 2nd element so on right?