x264 的common/frame.h里有如下一段代码:
int8_t *mb_type; int16_t (*mv[2])[2]; int8_t *ref[2]; int i_ref[2]; int ref_poc[2][16]; |
苏A-Bing~Q(76633731) 14:06:58
mv为含有2个元素的指针数组,
每个元素含有2个int16_t的一维数组
CTCA(172350634) 13:40:32
指针数组
CTCA(172350634) 13:40:41
指向int16_t [2]
实际测试一下: void CTest3Dlg::OnButton3() { // TODO: Add your control notification handler code here int (*mv[2])[2]; int arr1[2] = {3,4}; mv[0] = &arr1; CString str; str.Format("%d",mv[0][0][0]); AfxMessageBox(str); str.Format("%d",mv[0][0][1]); AfxMessageBox(str); } |
运行结果如下:
弹两次麻烦,一次弹出来算了:
void CTest3Dlg::OnButton3() { // TODO: Add your control notification handler code here /* int (*mv[2])[2]; int arr1[2] = {3,4}; mv[0] = &arr1; CString str; str.Format("%d",mv[0][0][0]); AfxMessageBox(str); str.Format("%d",mv[0][0][1]); AfxMessageBox(str); */ int (*mv[2])[2]; int arr1[2] = {1,2}; int arr2[2] = {3,4}; mv[0] = &arr1; mv[1] = &arr2; CString str; str.Format("mv[0][0][0]=%d;mv[0][0][1]=%d;mv[0][1][0]=%d;mv[0][1][1]=%d",mv[0][0][0],mv[0][0][1],mv[1][0][0],mv[1][0][1]); AfxMessageBox(str); } |
运行结果如下:
如果用如下的代码:
str.Format("%d",mv[0][1][0]);
AfxMessageBox(str);
并不提示出错,但是输出的值不确定: