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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:18:05+00:00 2026-06-02T05:18:05+00:00

Is an array with 0 elements the same as an unallocated pointer? Is int

  • 0

Is an array with 0 elements the same as an unallocated pointer?

Is int arr[0]; the same as int* arr;?

Edit: What if I did something similar to this:

int x[0];
int* const arr = x;

I tried this code and it compiled. To my knowledge, both x and arr should be pointing to the same location in memory. What would be the difference in this case?

  • 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-02T05:18:08+00:00Added an answer on June 2, 2026 at 5:18 am

    Not at all.

    In the case of arr[0], arr has a well defined address.

    In the case of *arr, arr is just uninitialized.

    After your EDIT, where you initialize the const arr with an array defined just before : there would just be no difference in the content of the variables, but in the actions you would be allowed to perform on them.

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

Sidebar

Related Questions

Is it worth to write code like the following to copy array elements: #include
I am trying to remove white space of array elements, but at the same
I have this code: $um = array(PHP, JAVA, MySQL) $a = count($um) for ($i
I wrote below code to compare to arrays that have same elements but in
Given an array of 2n elements of which n elements are same and the
Is subtraction of pointers not pointing to different elements of same array valid in
How can you create an array with from a set of elements with same
I would like to create something like a pointer to a 2 dimensional array
Exactly the same questions as Create an array with elements of different types ,
I have an array of elements in Ruby [2,4,6,3,8] I need to remove elements

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.