0xC0000005: Access Violation Occurs settlement location 0x00000000 when writing (rpm)

Above it is your sense of the value of the variable pay should not be assigned to, or that you can not pay the value of the variable pay (or constant)

( 1 ) the simplest and most straightforward error is probably scanf () problem, we all know that when the input is scanf ( " % format " , & variable), then in addition to the string (& will happen, but do not) the in addition, all inputs are needed &, 
if you lose, when in many compilers variation is to check out, that is not wrong, but the input data is poor students above error, because the written scanf ( " % format " , variable) this form, so variable that you have entered do not know where it would be stored. ( 2 ) a null pointer assignment problems. We know that if a pointer is empty is not the cause directly to his assignment is a null pointer do not know refers to the something, then he has no fixed memory, and now you give him an assignment, the popular point to understand is that he did not know how to do it do not know what there is, it will not store,
but now you need to let him store, then there is the above-mentioned problems, this time the solution is to re-apply for space (with malloc or new), or you try to avoid him become null pointer, or when he has the possibility to become a null pointer, you will be discussed separately. The following examples is possible: The following statement will be out of the question
int  * p =  0 ; p[0] = 100; Of course, the actual code can not be so obvious, this is just an example, may be similar, it was a good look at yourself, and actually above 0 NULL is the same, which is assigned a null pointer value. The following such an approach can cause problems a=(double*)malloc(sizeof(double)*6); h=......   a [ 0 ] = H;  // determines whether or not a blank, go to the use of very dangerous.
First, you do not know if malloc will succeed if it fails to return NULL happens to be under normal circumstances you assign such a point of memory is not a failure but as you said after several cycles you may not have run out of free memory fragmentation or malloc fails a  
've got to judge that question is just an exception to the null pointer assignment The following are three kinds of situations pointer online: we can look to their own circumstances and to his shining: Possibility 
. 3  Species  . 1 char  * P; new char[number];  delete [] p;  ....  // always using p....  p = xxx; // access violation  2 char  * the p-;  // points to a random position, may have problems. Memcpy (the p-, xxx, Number The);  //  Access Violation  3char *p; new char[number];  delete [] p;  .........  delete [] p; // access violation 0xC0000005 : Access Violation Error Debugging - - Supplementary sentence :( 1 ) there is no problem when compiling           ( 2 ) Run one cycle time is calculated, setting breakpoints, the first few cycles, no problems, to which a certain cycle (end of cycle condition has not been reached) the above-described problems occur. This time you are sure it is in the middle of what step will be assigned a null pointer value. ( 3 ) a pointer or array bounds And as long as the memory-related basically possible, of course, or pointer array bounds, this is very common, this is not an example of the child, I believe we can understand what consciousness, but also know how to solve this we need everyone more careful and carefully. ———————————————— Disclaimer: This article is the original article CSDN bloggers "Chinese Cong fast", and follow CC 4.0 BY- SA copyright agreement, reproduced, please attach the original source link and this statement. Original link: HTTPS: // blog.csdn.net/hhq420684/article/details/18181099

 

Guess you like

Origin www.cnblogs.com/Stephen-Qin/p/11704648.html