User forums > Help

Watch a complex struct when debugging

(1/2) > >>

su1:
Hello,

in my code I define a struct like this:


--- Code: --- 
Individuals *individuals = NULL;
individuals = malloc(10*sizeof(Individuals));
--- End code ---

When debugging, I know how to watch one individual at a time, by Right click > Adding watch > individuals[3] for example.

But I would like to be able to follow easily the values in every structure in individuals, ie individuals[0], individuals[1], etc... on the same screen (like what I've seen XCode is doing).

Is there a way to do that?

Thanks.

oBFusCATed:
Screen shot?

su1:
Screenshot of what? I can't give you a screen shot of what I want and don't have...  :D

But here's a screenshot of what I have for now:



As you can see, I can easily access individuals[1], or individuals[2],... But I would like to have in the same watch:

individuals[1]  individuals[2]      ...

offer             offer                 ...
request         request             ...
strength        strength            ...

oBFusCATed:
What you tried Right click -> Properties -> Watch as array?

su1:
I guess you mean Right click -> Edit watch -> Watch as array?

So yes I've tried, when I do this I obtain



--- Code: ---*individuals

[0] offer             
[1] request         
[2] strength       
...

--- End code ---

instead of


--- Code: ---*individuals

offer             
request         
strength       
...

--- End code ---

but still not what I want:


--- Code: ---individuals[1]  individuals[2]      ...

offer             offer                 ...
request         request             ...
strength        strength            ...

--- End code ---

It seems like the watch *individuals only shows individuals[0]

Navigation

[0] Message Index

[#] Next page

Go to full version