Array debugging by GDB

Source: Internet
Author: User

The Code is as follows:

1 // use non-recursion. Sum up the law through inductive verification. The number of elements in the enumeration is 2 int64 f_n (int64 M, int64 N) 3 {4 int64 A [m] [N]; 5 Int I, j; 6 for (I = 0; I <n; I ++) 7 {8 A [0] [I] = I + 1; // The first element in each column 9} 10 for (I = 0; I <m; I ++) 11 {12 A [I] [0] = I + 1; // The first element in each row 13} 14 for (I = 1; I <m; I ++) 15 {16 for (j = 1; j <n; j ++) 17 {18 A [I] [J] = A [I] [J-1] + A [I-1] [J]; 19} 20} 21 return a [M-1] [n-1]; 22}

The breakpoint is set in line 21 of the Code above, and GDB debugging is used to check that array a is stored in the stack.

When P & A [0] [0] is input, the following error occurs:

Cannot perform pointer math on incomplete types, try casting to a known type, or void *.
Bai Si cannot explain, later found the answer on stackoverflow, the link is as follows: http://stackoverflow.com/questions/6007440/why-i-cant-watch-the-expression-a11-after-declare-it-by-ann-in-c

The length of the debugging group must be determined. Change a [m] [N] to a [100] [100 ].

Stackoverflow is really a good thing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.