vs2010 c++ view pointers content by debug

前端 未结 2 1566
失恋的感觉
失恋的感觉 2021-02-10 09:17

I\'m working in Vs2010 c++ with 2D arrays. I started off with a 1D pointer and used the operation [] as the following:

class CMatrix
{
    void clear();
public:
         


        
相关标签:
2条回答
  • 2021-02-10 09:32

    In the QuickWatch window, you can type the name of the pointer variable followed by a comma and the number of array indices you want to view, e.g. MyMat, 10.

    0 讨论(0)
  • 2021-02-10 09:46

    One way is to use use the Memory viewer. While debugging ( when stoped at a Breakpoint ), goto the menu Debug > Windows > Memory > Memory 1 to get the memory viewer. Then type-in the memory address ( copy paste the value from your pointer ) so that you can view the memory around that area of your program memory.

    When you right click on memory viewer you can choose how you want to view the data ( as ANSI , as 4 integers, as 2 byte integers , as floats , bla bla... )

    Also you can use the Watch window at the debug time. just use your pointer as an array ( e.g. if your pointer is char * t, the syntax t[0] will give your data pointed by the pointer t

    0 讨论(0)
提交回复
热议问题