I have a dynamically allocated array of structs.
I want to cast it to an array type so my debugger will show the whole array.
Is it possible?
I know that this cast is not a good idea, but it's only a cast for expression evaluation of the debugger. –
I have a dynamically allocated array of structs.
I want to cast it to an array type so my debugger will show the whole array.
Is it possible?
I know that this cast is not a good idea, but it's only a cast for expression evaluation of the debugger. –
Yes. For example, if you allocated array of 100 elements of type t_my_struct then cast pointer to t_my_struct => pointer to array of 100 elements of type t_my_struct:
t_my_struct * Dynamic = ( t_my_struct * )calloc( 100, sizeof *Dynamic );
t_my_struct (* Static)[ 100 ] = ( t_my_struct (*)[ 100 ] )Dynamic;
Now you can see Static as static array in debugger. Works in MSVC.