Access violation reading location 0x00000000 là lỗi gì năm 2024

Đề bài : Lập một mảng 2 chiều m dòng , n cột . Giá trị của mỗi ô là từ 0 đến m*n . Hãy in các trường hợp tổng các dòng bằng nhau .

Ví dụ mảng x y x a b c

thì x+y+z = a+b+c

Bài làm của mình như thế này ( đã bỏ những thứ không ảnh hưởng đến lỗi đi )

PHP Code:

`

include int sodng,socot;

int i,c,dem=0; int **a;int different(int c ,int dong ,int cot) { return 1; } void in() {

for(

int dong=0;dong

}

printf("\n"); } printf("\n");

}

int tong(int dong ,int cot) { return 1; }void timgiatri(int dong , int cot) { for(int c=0;c<=sodng*socot;c++) { if (different(c,dong,cot)==1) { a[dong][cot]=c; * dòng này bị lỗi *\ if (dong

}

void main() { printf("So dong la :"); scanf("%d",&sodng); printf("So cot la:"); scanf("%d",&socot); a = new int*[socot]; for(i=0;i

}

`

Khi mình chạy thì giá trị các phần tử đều ra số rất lớn . Chạy debugging thì bị lỗi " Unhandled exception at 0x000A157C in BAI6-FINAL.exe: 0xC0000005: Access violation writing location 0x013AA000. " ở dòng đã đánh dấu . Số dòng mình để là sodng vì vi phạm phải từ cấm (???) nhé . Bạn nào biết giúp mình với .

I guess that I have a class pointer somewhere that have been set back to zero and that i'm calling it without checking if it points on something valid. Right?

i.e

and somewhere else:

Code:

m_pHandler->DoSomething();

The callstack isn't that helpful, it only shows: How can I find where the call is made?

Access violation reading location 0x00000000 là lỗi gì năm 2024

"The making of software, like the making of sausages, should never be watched." http://blog.gauffin.org - .NET Coding/Architecture

  • December 13th, 2006, 02:01 PM

    Re: Access violation reading location 0x00000000 Originally Posted by verifier

    How can I find where the call is made?

    Access violation reading location 0x00000000 là lỗi gì năm 2024

    In a call stack? You are in a debugger, aren't you?

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...

    -
    • December 13th, 2006, 02:07 PM

      Re: Access violation reading location 0x00000000

      Access violation reading location 0x00000000 là lỗi gì năm 2024
      Originally Posted by VladimirF

    In a call stack? You are in a debugger, aren't you?

    Let me answer you by quoting myself:

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Originally Posted by verifier

    The callstack isn't that helpful, it only shows:

    How can I find where the call is made?

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    "The making of software, like the making of sausages, should never be watched."

    http://blog.gauffin.org - .NET Coding/Architecture

    - December 13th, 2006, 02:40 PM

    Re: Access violation reading location 0x00000000

    Are you sure you are checking the call stack of the correct thread in your application? In the Visual Studio debugger, open the window with all the threads and check that.


    December 13th, 2006, 02:46 PM

    Re: Access violation reading location 0x00000000

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Originally Posted by verifier

    Let me answer you by quoting myself:

    Sorry, I guess I missed your point there...

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    So, nothing below that call in the stack? Not even addresses? The code you described will produce that error, but doesn't explain the missing call stack.
    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...

    -
    • December 13th, 2006, 03:00 PM

      Re: Access violation reading location 0x00000000

      I was thinking about your problem and came up with the code that reproduces it:

    Code:

    void CTest3App::AV() > { > int buff[2]; > for(int i = 0; i < 8; ++i) > { > buff[i] = 0; > } > }

    Basically, I blew the stack here

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...

    - December 13th, 2006, 03:03 PM

    Re: Access violation reading location 0x00000000

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Originally Posted by Marc G

    Are you sure you are checking the call stack of the correct thread in your application? In the Visual Studio debugger, open the window with all the threads and check that.

    Hey Marc, since he's got a 00000000() in a call stack - he's there all right...

    Access violation reading location 0x00000000 là lỗi gì năm 2024
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...


    December 14th, 2006, 02:36 AM

    Re: Access violation reading location 0x00000000

    Any suggestions to how I can find the problem? The application is quite big, going through all classes would take some time.