查看动态数组的内容

查看动态数组的内容

Content #

GDB调试的程序使用了动态数组:

x = (int*)malloc(25*sizeof(int));

请问在GDB中该如何查看该数组的内容?

  1. 使用artificial array
p *x@25
  1. 使用强制类型转换
p (int [25]) *x

From #