回答編集履歴

1

あまりにもサンプルコードが酷すぎたので、修正しました。すみません。

2015/11/19 03:54

投稿

shanxia
shanxia

スコア1038

test CHANGED
@@ -28,13 +28,17 @@
28
28
 
29
29
  ```C
30
30
 
31
- struct No numberList;
31
+ struct No number;
32
32
 
33
- for ( i = 1; i < 11; i++) {
33
+ struct No* pNum = &number;
34
34
 
35
- numberList.n = i;
35
+ for ( i = 2; i < 11; i++) {
36
36
 
37
+ pNum->n = i;
38
+
37
- numberList.next = (struct No*)malloc(sizeof(struct No));/* C++の場合はnewでもOK */
39
+ pNum->next = (struct No*)malloc(sizeof(struct No));/* C++の場合はnewでもOK */
40
+
41
+ pNum = pNum->next;
38
42
 
39
43
  }
40
44