aliquote.org

November 6, 2023

Solving the puzzle of the address-of operator. #clang

Other subtleties of the C language: There are two ways to index an array a, either a[i] or i[a], as illustrated below:

#include <stdio.h>

int main(void) {
  int arr[5] = {1, 2, 3, 4, 5};
  int i = 2;

  printf("i[arr]: %d\n", i[arr]);
  printf("arr[i]: %d\n", arr[i]);
}