<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 程序:使用指針打印字符串 > 原文: [https://beginnersbook.com/2019/02/c-program-to-print-string-using-pointer/](https://beginnersbook.com/2019/02/c-program-to-print-string-using-pointer/) 在本教程中,我們將編寫一個 C 程序,使用指針變量逐個字符地打印字符串。要了解此程序,您應該具備以下主題的基本知識: * [C 指針](https://beginnersbook.com/2014/01/c-pointers/) * [C 數組](https://beginnersbook.com/2014/01/c-arrays-example/) ## 使用指針打印字符串的程序 在下面的程序中,我們聲明了一個`char`數組來保存輸入字符串,并且我們已經聲明了一個`char`指針。我們已經將數組基地址(數組的第一個元素的地址)分配給指針,然后我們通過在[`while`循環](https://beginnersbook.com/2014/01/c-while-loop/)中遞增指針來顯示`char`數組的每個元素。 ```c #include <stdio.h> int main() { char str[100]; char *p; printf("Enter any string: "); fgets(str, 100, stdin); /* Assigning the base address str[0] to pointer * p. p = str is same as p = str[0] */ p=str; printf("The input string is: "); //'\0' signifies end of the string while(*p!='\0') printf("%c",*p++); return 0; } ``` **輸出:** ![C Program to Print String using Pointer](https://img.kancloud.cn/1f/70/1f70f335a9c3c9da405262637a23a13b_836x310.jpg) #### 相關 C 示例 1. [C 程序:用指針交換兩個數字](https://beginnersbook.com/2019/02/c-program-to-swap-two-numbers-using-pointers/) 2. [C 程序:創建,初始化并訪問指針變量](https://beginnersbook.com/2019/02/c-program-to-create-initialize-and-access-a-pointer-variable/) 3. [C 程序:查找前`n`個自然數的總和](https://beginnersbook.com/2017/10/c-program-to-find-the-sum-of-first-n-natural-numbers/) 4. [C 程序:查找兩個數的平均值](https://beginnersbook.com/2017/09/c-program-to-find-the-average-of-two-numbers/)
                  <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>

                              哎呀哎呀视频在线观看