Skip to content

Instantly share code, notes, and snippets.

@re-imagined
Last active April 5, 2016 05:06
Show Gist options
  • Select an option

  • Save re-imagined/ceada6a24cf6d5c6a1e4 to your computer and use it in GitHub Desktop.

Select an option

Save re-imagined/ceada6a24cf6d5c6a1e4 to your computer and use it in GitHub Desktop.

Revisions

  1. re-imagined revised this gist Apr 5, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion char STR[] = "Hello\!".md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ char STR[] = "Hello\!";
    ```
    cout << sizeof(STR);
    ```
    的结果是7,_因为后面还有一个结束符 "\0"。_
    的结果是7,**因为后面还有一个结束符 "\0"。**
    ```
    for(int i = 0 ; i<=6; i++){
    cout<<STR[i]; }
  2. re-imagined revised this gist Apr 5, 2016. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions char STR[] = "Hello\!".md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,13 @@
    ```c
    ```
    char STR[] = "Hello\!";
    有六个字符,但 cout << sizeof(STR); 的结果是7,_因为后面还有一个结束符 "\0"。_
    ```
    有六个字符,但
    ```
    cout << sizeof(STR);
    ```
    的结果是7,_因为后面还有一个结束符 "\0"。_
    ```
    for(int i = 0 ; i<=6; i++){
    cout<<STR[i]; }
    ```
    一样可以输出 Hello!
    ```
  3. re-imagined revised this gist Apr 5, 2016. 2 changed files with 7 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions char STR[] = "Hello\!".cpp
    Original file line number Diff line number Diff line change
    @@ -1,5 +0,0 @@
    char STR[] = "Hello\!";
    有六个字符,但 cout << sizeof(STR); 的结果是7,因为后面还有一个结束符 "\0"
    for(int i = 0 ; i<=6; i++){
    cout<<STR[i]; }
    一样可以输出 Hello!
    7 changes: 7 additions & 0 deletions char STR[] = "Hello\!".md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    ```c
    char STR[] = "Hello\!";
    有六个字符,但 cout << sizeof(STR); 的结果是7,_因为后面还有一个结束符 "\0"。_
    for(int i = 0 ; i<=6; i++){
    cout<<STR[i]; }
    一样可以输出 Hello!
    ```
  4. re-imagined renamed this gist Mar 27, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. re-imagined created this gist Mar 27, 2016.
    5 changes: 5 additions & 0 deletions char STR[] = "Hello\!".c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    char STR[] = "Hello\!";
    有六个字符 cout << sizeof(STR); 的结果是7因为后面还有一个结束符 "\0"
    for(int i = 0 ; i<=6; i++){
    cout<<STR[i]; }
    一样可以输出 Hello!