<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 使用庫函數進行 C 編程中的字符串操作 > 原文: [https://www.programiz.com/c-programming/string-handling-functions](https://www.programiz.com/c-programming/string-handling-functions) #### 在本文中,您將學習使用諸如`gets()`,`puts`,`strlen()`等庫函數在 C 中操作字符串。 您將學習從用戶那里獲取字符串并對該字符串執行操作。 您經常需要根據問題的需要來操作[字符串](/c-programming/c-strings "C strings")。 大多數(如果不是全部)時間字符串操作可以手動完成,但這會使編程變得復雜而龐大。 為了解決這個問題,C 在[標準庫](/c-programming/library-function "C standard library functions") `"string.h"`中支持大量的字符串處理函數。 下面討論幾種常用的字符串處理函數: | 函數 | 函數作用 | | --- | --- | | [`strlen()`](/c-programming/library-function/strlen "Strlen()") | 計算字符串的長度 | | [`strcpy()`](/c-programming/library-function/strcpy "Strcpy()") | 復制一個字符串到另一個 | | [`strcat()`](/c-programming/library-function/strcat "Strcat()") | 連接(連接)兩個字符串 | | [`strcmp()`](/c-programming/library-function/strcmp "Strcmp()") | 比較兩個字符串 | | `strlwr()` | 將字符串轉換為小寫 | | `strupr()` | 將字符串轉換為大寫 | 字符串處理函數在`"string.h"`頭文件下定義。 ```c #include <string.h> ``` **注意**:您必須包含以下代碼才能運行字符串處理函數。 ### `gets()`和`puts()` 函數`gets()`和`puts()`是兩個字符串函數,用于從用戶處獲取字符串輸入并分別進行顯示,如[上一章](/c-programming/c-strings "C strings")中所述。 ```c #include<stdio.h> int main() { char name[30]; printf("Enter name: "); gets(name); //Function to read string from user. printf("Name: "); puts(name); //Function to display string. return 0; } ``` **注意**:盡管`gets()`和`puts()`函數處理字符串,但這兩個函數都在`"stdio.h"`頭文件中定義。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看