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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:14:00+00:00 2026-06-07T12:14:00+00:00

friends I was just playing around with some pointer programs and realized that the

  • 0

friends I was just playing around with some pointer programs and realized that the GCC (and maybe the C standard) differentiates the static and dynamic arrays.

A dynamic array has a place-holder for the address of the elements in the array whereas for the static array, there is no memory location where the compiler stores the starting address of the element array.

I have an example program to demonstrate my confusion.

#include <iostream>
#int main(void)
{
  int _static[10];
  int *_dynamic;

  _dynamic = new int [10];

  std::cout<<"_static="<<_static<<" &_static="<<&_static<<" &_static[0]="<<&_static[0]<<std::endl;
  std::cout<<"_dynamic="<<_dynamic<<" &_dynamic="<<&_dynamic<<" &_dynamic[0]="<<&_dynamic[0]<<std::endl;

  return 0;
}

For the above program, _static and &_static[0] return the same address on the expected lines. However, the &_static also return the same address as the other two.

So, _static and &_static refer to the same number (or address whatever we would like to call it). As expected, _dynamic and &_dynamic indicate different locations.

So, why did the C standard say that _static and &_static must refer to the same location. It sounds confusing. One reason I feel is that &_static does not make much sense. But then should its usage not be reported as an error instead ?

Can somebody please help me with this confusion ?

  • 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-07T12:14:01+00:00Added an answer on June 7, 2026 at 12:14 pm

    Actually _static and &_static don’t refer to the same location. The only reason they appear to is because you use _static in a context in which it decayed into a pointer. That is, by the way you used them, you made them refer to the same location. But they didn’t before you did that — one was an array and the other was a pointer. They couldn’t be the same because they were fundamentally different things.

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

Sidebar

Related Questions

While playing around with the emulator, I noticed that when trying to view a
Alright friends of the WebDev community, I am just mucking around here and I
some friends just finished the implementation of an app and they use Custom Exceptions.
hello friends i just want to know that whether we can access or fetch
Recently I just finished a simple Facebook Air application, and some of my friends
Couldn't find_if just be an overload of find ? That's how std::binary_search and friends
I just realized that I don't have a answer to this question, when I'm
Rather than just grabbing the user's friends' emails, I want to show their list
I just created an iPhone app and am having friends try it out, but
G'day friends (I'm American, but G'day just sounds cool) I just installed the WCF

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.