我試圖編譯工作臺下面簡單的代碼:經過兩dimmensional陣列的功能
1. typedef float matrixType[3][3]
2.
3. void my_func(matrixType matrix)
4. {
5. printf("matrix[0][0] = %g\n",matrix[0][0]);
6. }
7.
8. void main()
9. {
10. matrixType my_matrix = {{0,1,2},{3,4,5},{6,7,8}};
11. matrixType* ptr_matrix = &my_matrix;
12.
13. my_func(*ptr_matrix);
14. }
我收到以下警告:
test.c:13: warning: passing arg 1 of `my_func' from incompatible pointer type
我不明白,是什麼我做錯了嗎?在Visual Studio中編譯相同的代碼時沒有任何警告,但在Workbench中出現了問題。
謝謝。
可能不是問題,但是你在第一行末尾丟失了分號。除此之外,代碼看起來對我來說確實很好。 – betabandido 2012-07-19 16:46:05