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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:51:27+00:00 2026-06-05T04:51:27+00:00

I started my adventure with C++ one week back. I have read a lot

  • 0

I started my adventure with C++ one week back. I have read a lot about C++.
I was experimenting with the following:

 char * String1 = "abcdefgh";

I, then, tried to modify its value in the following way:

 String1[2] = 'f';

This resulted in an UNHANDLED EXCEPTION.
But the following results in proper execution:

 char String2[9]="abcdefgh";

 String2[7]='s';

I tried to extract information about the binary generated using above code using DUMPBIN.
DUMPBIN is a Visual Studio Tool. I used the /ALL option to extract every information contained in the binary.

I could see two instances of “abcdefgh” in the RAWDATA section. And I understand why.

My questions are as follows:

1) Although both String1 and String2 are essentially pointers to two different instances of the same character sequence, why is the String1 manipulation not a legal one?

2) I know the compiler generates a SYMBOL TABLE for mapping variable names and their values. IS there any tool to visualize the SYMBOL TABLE in Windows OS?

3) If I have an array of integers instead of the character sequence, can it be found in the RAWDATA?

I could also see the following in RAWDATA:

Unknown Runtime Check Error.........
 Stack memory around _alloca was corrupted.......
  ....A local variable was used before it was initialized.........
 ....Stack memory was corrupted..
  ........A cast to a smaller data type has caused a loss of data.
  If this was intentional, you should mask the source of the cast with the appropriate bitmask.

How do these things get into the binary executable? What is the purpose of having these messages in the binary(which obviously is not readable)?

EDIT:
My question 1) has a word INSTANCES, which is used to mean the following:

The character sequence “abcdefgh” is derived from a set of non-capitalized ENGLISH ALPHABETS, i.e., {a,b,…,y,z}. This sequence is INSTANCIATED twice and stored at two memory locations, say A and B. String1, points to A(assumption) and String2 points to B. There is no conceptual mix-up in the question.

What I wanted to comprehend was the difference in the attributes of the memory locations A and B, i.e., why one of them was immutable.

  • 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-05T04:51:29+00:00Added an answer on June 5, 2026 at 4:51 am
    char string[] = "foo"
    

    This allocates a char array, and initializes it with the values {‘f’, ‘o’, ‘o’, ‘\0’}. You get “your own” storage for the chars, and you can modify the array.

    char strptr* = "foo"
    

    This allocates a pointer, and sets the value of that pointer to the address of a char array which contains {‘f’, ‘o’, ‘o’, ‘\0’}. The pointer is yours to do with as you wish, but the char array is not. In fact, the type of the array is not char[], but const char[], and strptr really ought to be declared as const char* so that you do not mistakenly attempt to modify the const array.

    In the first case, "foo" is an array initializer. In the second, "foo" is a string literal.

    More specific details about exactly where the memory for each situation is located tend to be unspecified by the standard. However, generally speaking, char string[] = "foo" allocates a char array on the stack, char strptr* = "foo" allocates a char pointer on the stack and (statically) allocates a const char array in the data section of the executable.

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

Sidebar

Related Questions

I have started development on a small 2d adventure side view game together with
Started using Visual Studio 2012 RC since yesterday, We have one WCF solution. Whenever
I started looking at HTML5 new history API However, I have one question. How
Alright, so I have started my adventure into the world of Objective-C and am
Started Googling today to research implementing Zend_Translate in a Zend 1.6.x project i have
Started practicing with XML and C# and I have an error message of There
Started working on a new application this week that is running the latest rails
Started learning Wicket after ASP.NET MVC and feel a little bit confused about managing
Started to learn programming 2 months ago, in one of my little projects i
I started out with Django some days ago and I have now made a

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.