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

  • Home
  • SEARCH
  • 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 8696393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:15:56+00:00 2026-06-13T01:15:56+00:00

Theorem says that we cannot initialize an array as a copy of another array.

  • 0

Theorem says that we cannot initialize an array as a copy of another array.
But we can initialize pointer as a copy of pointer that points to the first element of another array:

int a[] = {0, 1, 2}; 
int a2[] = a;       //error
int *a3 = a;        //OK

Why int a2[] = a; is an error?

  • 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-13T01:15:57+00:00Added an answer on June 13, 2026 at 1:15 am

    Arrays can’t be assigned to or initialized from another array object in C++ because they can’t in C, and they can’t in C for historical reasons that aren’t really relevant any more.

    In very early proto-C, there would have be some confusion whether an assignment like int a[] = {0}; int b[] = {0}; a = b; should copy the contents of array b to a, or re-seat the name a to refer to b. Likewise with initialization, whether a should be a copy of b or an alias. This ambiguity hasn’t existed for 40 years: it soon became clear that if it were to be allowed then the sensible meaning in C (and C++) would be that it should copy, but arrays in C were never made into “proper” value types.

    There’s no technical reason why it’s impossible, and for example you can assign a struct type that has an array as a data member. The standard simply doesn’t define your code to be correct C++.

    The behavior of pointers isn’t directly relevant to this. Initializing a pointer (to point to the first element of an array) is a different operation from initializing an array and its contents, and the language allows different things on the RHS.

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

Sidebar

Related Questions

I solved my homework problem, I used recursion tree. But solution says that this
i want to observe central limit theorem and wrote this program.But i confused that,must
My understanding is that Ladner's theorem is basically this: P != NP implies that
It is by now a well known theorem of the lambda calculus that any
I've seen quite a few papers on the SATCHMO theorem prover that talk about
Can someone please explain why this code doesn't work? Both Theorem and title are
I have a problem with theorem numbering in LaTeX. I can make it number
I am struggling to solve this equation. I concluded that the Master Theorem does
From Shannon's Source Coding Theorem we know that the entropy of a compressed string
I've looked all over the place, but it seems that examples I have seen

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.