A.s tr1
A.s tr2
A.s tr3
.
.
.
Then the members of the value will be changed in BBB () a function
Such as become
A.s tr1="1"
A.s tr2="2"
A.s tr3="3"
.
.
.
However, when the BBB () after completion of execution and returns on a layer of calling a function (pay attention to the track to the front of the return of BBB, these values are normal), all these values reach a into a
A.s tr1="2"
A.s tr2="3"
A.s tr3="4"
.
.
.
A.s TRN="mouth"
Last a.s TRN was supposed to be "n", has become a "mouth" of the code
Excuse me what reason, how should solve?
CodePudding user response:
Depending on the codeCodePudding user response:
Code is released, there is no code is a smart fantasiesCodePudding user response:
Let's track to see where is in modify the value of the stringCodePudding user response:
If there are any other places damaged dataCodePudding user response:
Before returning, set data breakpoint debugging operationCodePudding user response:
Fyi:# include & lt; time.h>
# include & lt; Stdlib. H>
# include & lt; Windows. H>
Int main () {
Int a, b [11].//was b [10], to decide which words of cross-border, intentionally statement for b [11]
Srand ((unsigned int) time (NULL));//press F11 twice, such as yellow right arrow pointing to the bank, the debugging, the new breakpoint, new data breakpoints, address: & amp; B [10], byte count: 4, sure,
While (1) {//press F5, will stop in the following sentence, as a value of 10, b has been modified to corresponding to 0. [10]. One of the four,
B (11) (a=rand () %]=0;
Sleep (100);
B (11) (a=rand () %]=1;
Sleep (100);
B (11) (a=rand () %]=2;
Sleep (100);
B (11) (a=rand () %]=3;
Sleep (100);
B (11) (a=rand () %]=4;
Sleep (100);
}
return 0;
}
CodePudding user response:
Suggest debug step by step, looking is what reason causes forwardCodePudding user response:
Single pace, affirmation is to program has a problem, so there is nothing wrong with using cstringsCodePudding user response:
Can't see the code is bullshitCodePudding user response:
The parameters of the function of BBB is a class a? Or other strong??CodePudding user response:
QQ ICodePudding user response:
Breakpoint debugging, it can't be coding problem, cstrings with such rightCodePudding user response:
Debugging data values puzzling change this kind of problem, please use the # 7 recommended by using the method of data breakpointsCodePudding user response:
This play should step to check, must be written code problem,CodePudding user response:
Estimation procedure where the errors seniorCodePudding user response:
The problem of good magic,CodePudding user response:
1 you may have outdated PDB file, cause debugging display an error (if the program runs it is normal)2 BBB has the damage ebp, return address errors, the first step should be added in compiling parameters/GS compile and add # pragma strict_gs_check (on), some static code analysis tools can also help you to find out the problems (such as Visual c + + compiler options/analyze),
CodePudding user response:
Consider a simple way to give it a try: remove temporary files in the project, etc, and then compile the program again and then run and have a lookCodePudding user response:
The