#include <stdio.h>

#define SIZE 10

int main(void)
{
    float numbers[SIZE] =
    { 0.0, 1.1, 2.2, 3.3, 4.4,
      5.5, 6.6, 7.7, 8.8, 9.9 };

    float *nPtr;

    printf("Using array subscript notation:\n");

    for (int i = 0; i < SIZE; ++i)
    {
        printf("%.1f\t", numbers[i]);
    }

    puts("");

    nPtr = numbers;

    printf("\nUsing pointer/offset notation with nPtr:\n");

    for (int i = 0; i < SIZE; ++i)
    {
        printf("%.1f\t", *(nPtr + i));
    }

    puts("");

    printf("\nUsing pointer/offset notation with array name:\n");

    for (int i = 0; i < SIZE; ++i)
    {
        printf("%.1f\t", *(numbers + i));
    }

    puts("");

    printf("\nUsing pointer/subscript notation:\n");

    for (int i = 0; i < SIZE; ++i)
    {
        printf("%.1f\t", nPtr[i]);
    }

    puts("");

    printf("\nElement 4 using array subscript notation: %.1f\n",
           numbers[4]);

    printf("Element 4 using pointer/offset notation with array name: %.1f\n",
           *(numbers + 4));

    printf("Element 4 using pointer/subscript notation: %.1f\n",
           nPtr[4]);

    printf("Element 4 using pointer/offset notation with nPtr: %.1f\n",
           *(nPtr + 4));

    printf("\nAddress referenced by nPtr + 8: %p\n",
           (void *)(nPtr + 8));

    printf("Value stored at that address: %.1f\n",
           *(nPtr + 8));

    nPtr = &numbers[5];

    nPtr -= 4;

    printf("\nAddress after nPtr -= 4: %p\n",
           (void *)nPtr);

    printf("Value stored at that address: %.1f\n",
           *nPtr);

    return 0;
}