本文介紹了如何在 Visual Studio 調試器中顯示動態分配的數組?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
如果您有一個靜態分配的數組,Visual Studio 調試器可以輕松顯示所有數組元素.但是,如果您有一個動態分配并由指針指向的數組,則當您單擊 + 將其展開時,它只會顯示該數組的第一個元素.有沒有一種簡單的方法可以告訴調試器,將此數據顯示為類型為 Foo 且大小為 X 的數組?
If you have a statically allocated array, the Visual Studio debugger can easily display all of the array elements. However, if you have an array allocated dynamically and pointed to by a pointer, it will only display the first element of the array when you click the + to expand it. Is there an easy way to tell the debugger, show me this data as an array of type Foo and size X?
推薦答案
是的,很簡單.說你有
char *a = new char[10];
在調試器中寫入:
a,10
會像數組一樣顯示內容.
would show you the content as if it were an array.
這篇關于如何在 Visual Studio 調試器中顯示動態分配的數組?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!