![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
いろいろなテクニック.Nucleo と DISCO-F746 用.
Dependencies: Array_Matrix mbed
Diff: MySort.hpp
- Revision:
- 1:bbb9f0c3e523
- Parent:
- 0:bb939e0bc6e2
diff -r bb939e0bc6e2 -r bbb9f0c3e523 MySort.hpp --- a/MySort.hpp Sun Oct 15 11:41:48 2017 +0000 +++ b/MySort.hpp Wed Apr 10 06:32:33 2019 +0000 @@ -13,7 +13,8 @@ for (int n=0; n<N; n++) printf(" %s\r\n", data0[n].c_str()); - string *data1 = new string[N]; +// string *data1 = new string[N]; + string data1[N]; // これでもよい for (int n=0; n<N; n++) data1[n] = data0[n]; sort(data1, data1+N); // 配列 printf("ソート後:\r\n"); @@ -21,7 +22,7 @@ printf(" %s\r\n", data1[n].c_str()); printf("\"MySorth\" の終了\r\n"); - delete [] data1; +// delete [] data1; // data1 に new で確保した領域を割り当てない場合は,これは不要 } // array, vector を昇順にソートする