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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:42:27+00:00 2026-05-12T17:42:27+00:00

Without initialization how is it possible to assign values to arrays? string[] s={all,in,all}; I

  • 0

Without initialization how is it possible to assign values to arrays?

string[] s={"all","in","all"};

I mean why did not the compile show error?.Normally we need to 
initialize ,before assign values.
  • 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-12T17:42:27+00:00Added an answer on May 12, 2026 at 5:42 pm

    It’s just syntactic sugar.

    This:

    string[] s = {"all","in","all"};
    

    is compiled to the same code as:

    string[] tmp = new string[3];
    tmp[0] = "all";
    tmp[1] = "in";
    tmp[2] = "all";
    string[] s = tmp;
    

    Note that the array reference is not assigned to s until all the elements have been assigned. That isn’t important in this particular case where we’re declaring a new variable, but it would make a different in this situation:

    string[] s = { "first", "second" };
    s = new string[] { s[1], s[0] };
    

    The same is true for object and collection initializers – the variable is only assigned at the end.

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

Sidebar

Related Questions

Without calculating them , I mean?
Without having the full module path of a Django model, is it possible to
Without thinking about it at all I just want to say I should allow
Is it possible to get the class type from inside the static initialization block?
I have alot of not always static values (slogan, banner, description...) and PartialViews (block_head,
Without the use of any external library, what is the simplest way to fetch
Without getting a degree in information retrieval, I'd like to know if there exists
Without spending a long time reviewing the boost source code, could someone give me
Without using Javascript, is there a way to make a CSS property toggle on
Without using a WebBrowser control, how could I execute a JavaScript function, that is

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.