回答編集履歴

2

追記

2020/07/22 06:37

投稿

episteme
episteme

スコア16614

test CHANGED
@@ -3,3 +3,13 @@
3
3
 
4
4
 
5
5
  int* m なので sizeof(*m) すなわち sizeof(int) ... これってたったの 4 ですけど、いいんですか?
6
+
7
+
8
+
9
+ [追記] ごめん早トチリ。
10
+
11
+
12
+
13
+ 0~maxの**max+1個のint領域**を確保せにゃならんのなら
14
+
15
+ calloc(max+1, sizeof(*m)) // sizeof(*m)バイト max+1個分の領域を確保

1

微修正

2020/07/22 06:37

投稿

episteme
episteme

スコア16614

test CHANGED
@@ -1,3 +1,5 @@
1
1
  > int *s = calloc(max, sizeof(*m) + 1);
2
2
 
3
+
4
+
3
5
  int* m なので sizeof(*m) すなわち sizeof(int) ... これってたったの 4 ですけど、いいんですか?