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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:57:59+00:00 2026-05-27T23:57:59+00:00

As usually reading through stuff I got this question in mind. If I have

  • 0

As usually reading through stuff I got this question in mind.
If I have a character array initialization like below , what will be the time complexity for this statement?

char array[] = {'a','b','c','d','e'};

Will it actually execute 5 time to assign each variable; as we do in loop. If assumption is true why is it so?

  • 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-27T23:58:00+00:00Added an answer on May 27, 2026 at 11:58 pm

    depending on where the declaration occurs and the compiler’s intelligence, it could be O(1) or O(n). some cases:

    1. global declaration, smart compiler would put it in data section, already initialized, thus O(1)
    2. local declaration, if proven to be read only by a smart compiler, it could be like above, plus a reference assignment to the array, still O(1) however
    3. local declaration, read write, could be storage allocation + 5 assignment (clearly O(n) OR storage allocation + array data copy (like 2, but the data gets copied instead of only the reference). the latter could be O(1) with vectorized code (well… more or less because it depends on quite a lot of things)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually when I need to fork in C, I do something like this: pid_t
I know, I know... Eric Lippert's answer to this kind of question is usually
I came across this class while reading a C# book and have some questions.
I have an interesting situation that my usually clever mind hasn't been able to
When I run this code through several entries of a directory, it usually returns
i just create reading file feature. In general, what kind PHP class that usually
Usually when defining a DAO, you would have a setter for the datasource on
Usually I tend to install things via the package manager, for unixy stuff. However,
I was reading this html generated, (may expire , Here is the original ps
When reading about the crossover part of genetic algorithms, books and papers usually refer

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.