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 9100951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:59:51+00:00 2026-06-17T00:59:51+00:00

Today I browsed some source code (it was an example file explaining the use

  • 0

Today I browsed some source code (it was an example file explaining the use of a software framework) and discovered a lot of code like this:

int* array = new int[10]; // or malloc, who cares. Please, no language wars. This is applicable to both languages
for ( int* ptr = &(array[0]); ptr <= &(array[9]); ptr++ )
{
   ...
}

So basically, they’ve done “take the address of the object that lies at address array + x“.

Normally I would say, that this is plain stupidity, as writing array + 0or array + 9 directly does the same. I even would always rewrite such code to a size_t for loop, but that’s a matter of style.

But the overuse of this got me thinking: Am I missing something blatantly obvious or something subtely hidden in the dark corners of the language?

For anyone wanting to take a look at the original source code, with all it’s nasty gotos , mallocs and of course this pointer thing, feel free to look at it online.

  • 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-17T00:59:51+00:00Added an answer on June 17, 2026 at 12:59 am

    You’re not missing anything, they do mean the same thing.

    However, to try to shed some more light on this, I should say that I also write expressions like that from time to time, for added clarity.

    I personally tend to think in terms of object-oriented programming, meaning that I prefer to refer to “the address of the nth element of the array”, rather than “the nth offset from the beginning address of the array”. Even though those two things are equivalent in C, when I’m writing the code, I have the former in mind – so I express that.

    Perhaps that’s the reasoning of the person who wrote this as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today, I have looked into HTML code of facebook.com, and found something like this:
I'd like to get some code editing for a free software project done during
Today while I was writing some code for two methods that shows and hides
I recently upgraded my django framework from 1.3 to 1.4. Today I ran some
Steps to reproduce: Use source for GraphAPI_Mobile_1_8.swc today Add it to a Adobe CS5.5;
Today I read some posts about the 'autocomplete' browser generated in the text fields,
This question came today in the manipulatr mailing list. http://groups.google.com/group/manipulatr/browse_thread/thread/fbab76945f7cba3f I am rephrasing. Given
Possible Duplicate: How to download a text file or some objects from webpage using
Currently I am writing a website using Kohana framework 3.3. Today, I wanted to
I've some strange thing with pymongo - yesterday my code worked just fine, by

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.