D
dotNeter
My source code declared two types of string,
static char* str = "hello, world";
static char str1[] = "hello, world";
The only difference between them is the memory allocation while
compiling time.
And the first one can't be modified through the pointer, whereas the
second one can.
The debug version works well but the release one must crash, at the
time that it trigered an operation which need the content of string.
If I modified the declaration char* to char[], even release version is
okay.
I can't exactly know why and how to solve it, but it was supposed to be
a segmentation error, namely, likely to be a pointer error.
Can someone give a hint?
static char* str = "hello, world";
static char str1[] = "hello, world";
The only difference between them is the memory allocation while
compiling time.
And the first one can't be modified through the pointer, whereas the
second one can.
The debug version works well but the release one must crash, at the
time that it trigered an operation which need the content of string.
If I modified the declaration char* to char[], even release version is
okay.
I can't exactly know why and how to solve it, but it was supposed to be
a segmentation error, namely, likely to be a pointer error.
Can someone give a hint?