---
title: "Discussion on \"When C++ Gets Weird: i[a] and the Power of Pointer Arithmetic\" | Hashnode"
description: "Discussion on \"When C++ Gets Weird: i[a] and the Power of Pointer Arithmetic\". When you first learn arrays in C++, you’re taught that a[i] accesses the i-th element of the array. Simple enough, right?\nBut what if I told you that writing i[a]—yes, flipping the index and the array—also works?\nThis might seem like a typo, or even ..."
url: "https://hashnode.com/posts/when-c-gets-weird-ia-and-the-power-of-pointer-arithmetic/682b68a4c7d4b487fd2b5a9f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [When C++ Gets Weird: i\[a\] and the Power of Pointer Arithmetic](https://when-arrays-get-weird-in-c.hashnode.dev/when-c-gets-weird-ia-and-the-power-of-pointer-arithmetic?utm_source=hashnode&utm_medium=feed)

When you first learn arrays in C++, you’re taught that a\[i\] accesses the i-th element of the array. Simple enough, right? But what if I told you that writing i\[a\]—yes, flipping the index and the array—also works? This might seem like a typo, or even ...

May 19, 2025 · 3 min read · when-arrays-get-weird-in-c.hashnode.dev  
Read the article

-   [#cppmagic](https://hashnode.com/tag/cppmagic)
-   [#chaiaurdsa](https://hashnode.com/tag/chaiaurdsa)
-   [#hiteshchaudhary](https://hashnode.com/tag/hiteshchaudhary)
-   [#cpp-ck4ra5k7300nlv2s1jbkdp2qh](https://hashnode.com/tag/cpp-ck4ra5k7300nlv2s1jbkdp2qh)
-   [#dsa](https://hashnode.com/tag/dsa)

## Written by

[Vikram Shrivastav](https://hashnode.com/@VikramShrivastav)

@VikramShrivastav

  
[View profile](https://hashnode.com/@VikramShrivastav)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
