简体   繁体   中英

How to view contents of an array while debugging in Code Blocks?

This is probably a silly question and i am posting this Post-Googling, The question is,

How do i view the contents of an array while debugging, Provided the Breakpoint is in function not Main?

I am using code::blocks 13.12 version and i set a break point in my sample simple c++ code, and i want to observe how the contents of the array change with the code but all i see is the the address of the array under watch window, It is however displaying the values of other integer variables correctly,

在此输入图像描述

a is an array

I forgot to mention that i am tracking the array in a function and not in main,and i am aware that main passes the address of the array to the function being called(by reference i meant)

I am relatively new to codeblocks, Am i missing some setting or something?

右键单击单元格,然后选择“属性”,在那里你可以告诉它“看作数组”,并告诉它要观察的索引范围。

i am using 12.11. I select the array variable suppose a, choose "watch a" in the right button down menu, and I can see the values in the array a.

Another thing that I use is watching under cursor.

If you go Settings -> Debugger... -> GDB/CDB debugger -> Default and you enable selection "Evaluate expressions under cursor", every time you leave mouse pointer above a variable in the code, it will be watched.

It's not the same with having it in Watches toolbar, but strangely it will show array's fields.

Debug -> Debugging windows -> Watches

you may watch the variables in this way

in convenience, you can find button "Debugging Windows" near to the debug toolbar, choose "watch", hope you can find it!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM