Search code examples
carrayspointersnotation

Can someone give me an example of "pure pointer notation" to an array in C?


I'm looking for an example of 'pure pointer notation' in C. I have an assignment to convert a program to pure pointer notation and it uses a lot of arrays. Also, can you give an example of what would not constitute as pure pointer notation?

Thank you in advance for the help.


Solution

  • Pure pointer notation basically just means using pointer arithmetic to address the elements of the array, rather than the [...] array index operator.

    For example:

     someArray[10] = newValue;
    

    is the same as

     *(someArray + 10) = newValue;