teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

No need to fill s\[j\] by '\\0'\.

2016/05/09 02:47

投稿

majiponi
majiponi

スコア1722

answer CHANGED
@@ -10,7 +10,8 @@
10
10
  j++;
11
11
  }
12
12
  }
13
- s[j] = '\0';
14
13
  s.resize(j);
15
14
  }
16
- ```
15
+ ```
16
+
17
+ Without resizing, this string is not null-terminating.

1

Fixed to be null-terminated string\.

2016/05/09 02:47

投稿

majiponi
majiponi

スコア1722

answer CHANGED
@@ -10,6 +10,7 @@
10
10
  j++;
11
11
  }
12
12
  }
13
+ s[j] = '\0';
13
14
  s.resize(j);
14
15
  }
15
16
  ```