Displaying values in a loop

Need help with C, C++, perl, python, etc?

Displaying values in a loop

Postby MVD » 2007-04-16 08:43

I have a situation like below:

int k=2,j=0,i;

for(i=0; i< 4; i++)


Now, while debugging using gdb in for loop to display values j and k , I can use print j and print k.
But, Is there a way to display there values every time there values are changed till the control is in for loop ?


Postby lacek » 2007-04-16 14:27

You can display a variable's value using the "display" command.
If you don't need it any more, use the "undisplay" command to disable the given display.
It may not be what you want (it doesn't "automatically" displays values), but is better than "print"ing on every command...
Moderator Team Member
Posts: 769
Joined: 2004-03-11 18:49
Location: Budapest, Hungary

Postby cassio » 2007-04-17 17:34

Posts: 8
Joined: 2007-01-24 15:38

Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests