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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:34:05+00:00 2026-05-28T07:34:05+00:00

int a[10]; int b[10]; a = b; // illegal typedef struct { int real;

  • 0
int a[10];
int b[10];

a = b; // illegal

typedef struct {
    int real;
    int imag;
    } complex;

complex c,d;
c = d; //legal

[I realize that a and b are addresses in 1st case,but symbols in 2nd 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-05-28T07:34:05+00:00Added an answer on May 28, 2026 at 7:34 am

    For historical info, this may be interesting: http://cm.bell-labs.com/who/dmr/chist.html

    In B, declaring an array would set aside memory for the array, just as C does, but the name supplied for the variable was used to define a pointer to the array. Ritchie changed this in C, so that the name “is” the array but can decay to a pointer when used:

    The rule, which survives in today’s C, is that values of array type
    are converted, when they appear in expressions, into pointers to the
    first of the objects making up the array.

    This invention enabled most existing B code to continue to work,
    despite the underlying shift in the language’s semantics. The few
    programs that assigned new values to an array name to adjust its
    origin—possible in B and BCPL, meaningless in C—were easily repaired.

    If at that very early stage, Ritchie had defined a = b to copy the array, then the code he was trying to port from B to C would not have been as easily repaired. As he defined it, that code would give an error, and he could fix it. If he’d made C copy the array, then he would have silently changed the meaning of the code to copy the array rather than reseating the name being used to access an array.

    There’s still the question, “why hasn’t this feature been added in the 40 years since”, but I think that’s why it wasn’t there to start with. It would have been effort to implement, and that effort would actually have made that early version of C worse, in the sense of being slightly harder to port B and BCPL code to C. So of course Ritchie didn’t do it.

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

Sidebar

Related Questions

The following code is illegal: public struct MyStruct { public MyStruct(int a, int b)
Please consider the following code: typedef struct { int type; } object_t; typedef struct
The following code outputs Illegal seek: #include <stdio.h> #include <errno.h> #include <string.h> int main()
int main(void) { std::string foo(foo); } My understanding is that the above code uses
Is this illegal/dangerous? int* static_nonew() { static int n = 5; return &n; }
Why am I getting the error :java:16: error: illegal start of type for(int i
Consider: int* ptr = (int*)0xDEADBEEF; cout << (void*)&*ptr; How illegal is the * ,
int a = 10; switch(a){ case 0: printf(case 0); break; case 1: printf(case 1);
I am not particularly new to C/C++ but today I discovered some things that
struct X { X():mem(42){} void f(int param = mem) //ERROR { //do something }

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.