<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # C `strstr()`函數 > 原文: [https://beginnersbook.com/2017/11/c-strstr-function/](https://beginnersbook.com/2017/11/c-strstr-function/) **`strstr()`函數**在指定主字符串中搜索給定字符串,并返回指向給定字符串第一次出現的指針。 ## C `strstr()`函數聲明 ```c char *strstr(const char *str, const char *searchString) ``` `str` - 要搜索的字符串。 `searchString` - 我們需要在其中搜索字符串`str`的字符串 ## `strstr()`的返回值 此函數返回指向給定字符串第一次出現的指針,這意味著如果我們打印此函數的返回值,它應顯示主字符串的一部分,從給定字符串開始直到主字符串末尾。 ## 示例:C 中的`strstr()`函數 ```c #include <stdio.h> #include <string.h> int main () { const char str[20] = "Hello, how are you?"; const char searchString[10] = "you"; char *result; /* This function returns the pointer of the first occurrence * of the given string (i.e. searchString) */ result = strstr(str, searchString); printf("The substring starting from the given string: %s", result); return 0; } ``` 輸出: ```c The substring starting from the given string: you? ``` 正如您所看到的那樣,我們正在使用函數`strstr()`在字符串`"Hello, how are you?"`中搜索字符串`"you"`。由于函數將返回字符串`"you"`的第一次出現的指針,因此字符串`str`的從`"you"`開始的子字符串已被打印為輸出。 #### 相關文章: 1. [C - `strspn()`示例](https://beginnersbook.com/2017/11/c-strspn-function/) 2. [C - `strrchr()`示例](https://beginnersbook.com/2017/11/c-strrchr-function/) 3. [C - `strcpy()`示例](https://beginnersbook.com/2017/11/c-strcpy-function/) 4. [C - `strcmp()`示例](https://beginnersbook.com/2017/11/c-strcmp-function/)
                  <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>

                              哎呀哎呀视频在线观看