Problem with memory allocation in C ++

My code is as follows:

#include <string.h>
int main()
{
    int ii = 123;
    char str[7] = "";
    strcpy(str,"123456");
    return 0;
}

I run this in VS2010, memory below

enter image description here

I'm curious what to use ccin memory? And how is the quantity calculated cc?

+5
source share
2 answers

When compiling for "Debugging" in Visual Studio, ccit is often used to fill uninitialized memory. Thus, this becomes more apparent when accessing uninitialized memory.

For example, if you try to dereference an uninitialized pointer, you will probably get something like:

Access Violation accessing 0xcccccccc

or something like that.

enter image description here

+7
source

, VC2010 , , 0xcccccccc,

0xcc - , ( ) .

+1

All Articles