Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8522719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:12:17+00:00 2026-06-11T07:12:17+00:00

Sometimes i see different array-access styles in C++ and thought it could be relative

  • 0

Sometimes i see different array-access styles in C++ and thought it could be relative to an assembly addressing mode:

C++:

int * aa=new int[2];
0[aa]=15; //a little different than aa[0]
1[aa]=15;
aa[0]=15;
aa[1]=15;
printf("%d %d \n",aa[0],aa[1]);

Assembly:

__asm
{
    mov aa[0],ebx
    mov aa[1],eax
    mov 0[aa],ebx
    mov 1[aa],eax
}

Is this C++ array-access notation a standard and if yes, was it derived from an assembly addressing mode?

When i try [aa]1=5; , compiler gives

  • “aa attribute not found”,
  • “missing ‘;’ before ‘constant'”
  • “left operand must be l-value”.

    //When i try pointer arithmetic,

    *(aa+1)=0//gives no error

    *(aa+0)=0//gives no error 🙂

Is this rule same for the operator [] overloading?

MSVC++ 2010

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:12:19+00:00Added an answer on June 11, 2026 at 7:12 am

    This is a well-known quirk of C and C++, they don’t really care which half of an expression goes in the square brackets []. They both evaluate to the same equivalent expression:

    *(0+aa)=15;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For Qt qmake variables I sometimes see different notations. Examples $$PWD $${PWD} For me
Sometimes I see the following code into two different formats: Format 1: #import <UIKit/UIKit.h>
I see a lot of different styles of variable names used in different kind
Sometimes I have to delete two records on different tables. How could I execute
I sometimes see messages like Process 12990 waits for ExclusiveLock on tuple (889,66) of
While browsing SO I sometimes see EOFD for example: ftp -vn <$hostname> <<EOFD Yes
When creating iPhone apps in simulator, I sometimes see messages like Springboard failed to
sometimes i see an image not being served when the browser look at www.somesite.com/some_image.jpg
Sometimes I see and have used the following variation for a fast divide in
Sometimes I see @cc_on in JavaScript. What does it mean?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.