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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:30:23+00:00 2026-06-15T22:30:23+00:00

for the following code I was wondering if there is just an array created

  • 0

for the following code I was wondering if there is just an array created in the stack or if there is also an array created in the static. I’m just kind of confused with array creation from a string.

char str[] = "White";

I’m assuming this creates a pointer in the stack called str which points to an array with the following contents, "White\0", in the static memory. Is this correct as an assumption?

  • 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-15T22:30:24+00:00Added an answer on June 15, 2026 at 10:30 pm

    Nope.

    "White" is an array of char[6] in static memory somewhere. (or magic land, it’s not specified, and is completely irrelevant). Note that it may or may not be the same static array as another "White" elsewhere in the code.

    char str[] = "White"; creates a new local char[6] array on the stack, named str, and copies the characters from the static array to the local array. There are no pointers involved whatsoever.

    Note that this is just about the only case where an array can be copied. In most situations, arrays will not copy like this.

    If you want a pointer to the magic static array, simply use const char* str = "White";

    Phonetagger notes that if the line of code is not in a function, then str is not on the stack, but also in the magic static memory, but the copy still (theoretically at least) happens just before execution begins of code in that translation unit.

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

Sidebar

Related Questions

I am wondering if there is any potential security risk from the following code.
Just wondering if there is anyway to represent the following code in C# 3.5:
I'm wondering why the following code doesn't work: String test = new String(new byte[]
So I am just wondering why the following code dosen't work. I am looking
Just wondering, having the following simple code: var object1 = { name: function (){
I was just wondering why my following code doesn't work: EDIT: The following code
I was just wondering if there is a better way to do the following
I have the following code and was wondering why I am not allowed to
I was wondering how can I allow NULL values in the following code below
The following code basically works as expected. However, to be paranoid, I was wondering,

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.