//----------a[0]是一个指针,指向一个数组中数据。a也是一个指针,但不指向一个数据,而是指向一个指针地址a[]?
因为如此,所以一下代码出现错误:
C:/Documents and Settings/ra/array.cpp(9) : error C2109: subscript requires array or pointer type
C:/Documents and Settings/ra/array.cpp(43) : error C2664: 'dotProduct' : cannot convert parameter 1 from 'int (*)[4]' to 'int *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
array.exe - 7 error(s), 0 warning(s)
改成以下形式就可以了,运行一切正常,哈哈
甚至以下这种都正常,原因是参数中第一维不起作用