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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:30:48+00:00 2026-06-13T13:30:48+00:00

Possible Duplicate: C: How come an array’s address is equal to its value? I

  • 0

Possible Duplicate:
C: How come an array’s address is equal to its value?

I test in GCC 4.4.1 and I find &a=a. I can’t understand it. I think &a should be the address where stores the address of the array, it can’t be the same. Could someone give me a good explanation? Thanks very much.

  • 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-13T13:30:49+00:00Added an answer on June 13, 2026 at 1:30 pm

    An array is an object in memory. It has an address and a size. It’s also true that in certain contexts, an array decays into a pointer to its first element. So numerically, if both a and &a are compared as pointer values, they compare as equal, since they both point to the same address in memory. But they have different data types: a has type int[4] (“array 4 of int“), or int* (“pointer to int“) in certain contexts, whereas &a always has type int (*)[4] (“pointer to array 4 of int“).

     &a points here
     |
     V
    +------+------+------+------+
    | a[0] | a[1] | a[2] | a[3] |  sizeof(a) == 16
    +------+------+------+------+
     ^
     |
     &a[0] also points here
     In certain contexts, 'a' means &a[0]
    

    Hence, (void *)a == (void *)&a.

    Also note that because a and &a point to different data types (and in particular, the pointed-to types have different sizes), doing pointer arithmetic will yield different results. a+1 will point to &a[1] (advances by one int value), whereas &a+1 will point to just past the end of the array at &a[4], since it advances by one “array 4 of int” unit:

                           &a+1 points here
                                 |
                                 V
    +------+------+------+------+
    | a[0] | a[1] | a[2] | a[3] |
    +------+------+------+------+
            ^
            |
      a+1 points here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C: How come an array’s address is equal to its value? Could
Possible Duplicate: C: How come an array’s address is equal to its value? C
Possible Duplicate: C: How come an array’s address is equal to its value? SA
Possible Duplicate: C: How come an array’s address is equal to its value? int
Possible Duplicate: C# Why can equal decimals produce unequal hash values? I've come across
Possible Duplicate: How come I can't remove the blue textarea border in Twitter Bootstrap?
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Negative array indexes in C? How come this compiles, and runs as
Possible Duplicate: Return variable with the highest value? I'm trying to come up with

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.