How to "watch" all contents of a dynamically created multi-dimension array in Visual Studio debug -


i have 2 dimension array created malloc. simplified code like:

double **p = dmatrix(0, 50, 0, 50); 

when debugging, want see content 51*51 members in 1 go. tried use below in "watch":

p,51; //to show address 1st dimension, can't expand 2nd dimension. (only show 1st one) p[0][0]; //to show [0][0] p[0],51; //to show 51 members p[0] 

i hope like:

p,51 51 //to show address 1st dimension, while can expand 2nd dimension. 

any suggestions? i've tried "memory" window it's not intuitive..

just found 1 solution myself. let's assume have below pointer:

double ** p; // assume 51*51 

then can write below in visual studio debug watch:

(double(*)[51]) p[0],51 

which cast array below, , can view contents in 1 go.

double[51][51] p; 

similarly, can apply 3 dimension pointers, write like:

(double(*)[51][51]) p[0][0],51  //for 51*51*51 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -