回答編集履歴
1
追記
test
CHANGED
@@ -5,3 +5,65 @@
|
|
5
5
|
コンパイル・エラーとなって当然かと。
|
6
6
|
|
7
7
|
引数に配列を与える場合、要素数は**定数**でなくてはならんので。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
```C
|
12
|
+
|
13
|
+
#include <stdio.h>
|
14
|
+
|
15
|
+
void put_hyo(int gyo, int retu, int* hyo){
|
16
|
+
|
17
|
+
int i=0;
|
18
|
+
|
19
|
+
int j=0;
|
20
|
+
|
21
|
+
printf("{\n");
|
22
|
+
|
23
|
+
for ( i = 0; i < gyo-1; i++)
|
24
|
+
|
25
|
+
{
|
26
|
+
|
27
|
+
printf(" { %2d",hyo[i*retu+0]);
|
28
|
+
|
29
|
+
for ( j = 1; j < retu; j++)
|
30
|
+
|
31
|
+
{
|
32
|
+
|
33
|
+
printf(", %2d",hyo[i*retu+j]);
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
printf(" },\n");
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
printf(" { %2d",hyo[(gyo-1)*retu+0]);
|
42
|
+
|
43
|
+
for ( j = 1; j < retu; j++)
|
44
|
+
|
45
|
+
{
|
46
|
+
|
47
|
+
printf(", %2d",hyo[(gyo-1)*retu+j]);
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
printf(" }\n}\n");
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
int main() {
|
58
|
+
|
59
|
+
int matrix[2][3] = { {1, 2, 3},
|
60
|
+
|
61
|
+
{4, 5, 6} };
|
62
|
+
|
63
|
+
put_hyo(2, 3, (int*)matrix);
|
64
|
+
|
65
|
+
return 0;
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
```
|