久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='BYblK'></bdo><ul id='BYblK'></ul>
      <i id='BYblK'><tr id='BYblK'><dt id='BYblK'><q id='BYblK'><span id='BYblK'><b id='BYblK'><form id='BYblK'><ins id='BYblK'></ins><ul id='BYblK'></ul><sub id='BYblK'></sub></form><legend id='BYblK'></legend><bdo id='BYblK'><pre id='BYblK'><center id='BYblK'></center></pre></bdo></b><th id='BYblK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BYblK'><tfoot id='BYblK'></tfoot><dl id='BYblK'><fieldset id='BYblK'></fieldset></dl></div>
      <legend id='BYblK'><style id='BYblK'><dir id='BYblK'><q id='BYblK'></q></dir></style></legend>

      <small id='BYblK'></small><noframes id='BYblK'>

        <tfoot id='BYblK'></tfoot>

        作為函數參數傳遞的數組的大小

        sizeof an array passed as function argument(作為函數參數傳遞的數組的大小)
          1. <i id='CSB5V'><tr id='CSB5V'><dt id='CSB5V'><q id='CSB5V'><span id='CSB5V'><b id='CSB5V'><form id='CSB5V'><ins id='CSB5V'></ins><ul id='CSB5V'></ul><sub id='CSB5V'></sub></form><legend id='CSB5V'></legend><bdo id='CSB5V'><pre id='CSB5V'><center id='CSB5V'></center></pre></bdo></b><th id='CSB5V'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CSB5V'><tfoot id='CSB5V'></tfoot><dl id='CSB5V'><fieldset id='CSB5V'></fieldset></dl></div>

              • <small id='CSB5V'></small><noframes id='CSB5V'>

                <tfoot id='CSB5V'></tfoot>
                  <tbody id='CSB5V'></tbody>
                <legend id='CSB5V'><style id='CSB5V'><dir id='CSB5V'><q id='CSB5V'></q></dir></style></legend>

                  <bdo id='CSB5V'></bdo><ul id='CSB5V'></ul>
                • 本文介紹了作為函數參數傳遞的數組的大小的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  可能的重復:
                  函數參數中數組的長度

                  我正在做作業,我完全被難住了.我們假設列表的每個順序都是一個整數數組,所以我根據老師的偽代碼編寫了這段代碼:

                  Hi am doing homework and I am completly stumped. We were suppose to get every order of a list an array of integers so I wrote this piece of code, based off of my teacher's pseudocode:

                  void permute(int v[], int curr,char letters[])
                  {
                      if(curr >= sizeof(v)/sizeof(int))
                      {
                          checkit(v,letters);
                      }
                      for(int i = curr; i < sizeof(v)/sizeof(int); i++)
                      {
                          swap(i,curr,v);
                          permute(v,curr + 1,letters);
                          swap(v[curr],v[i]);
                      }//for
                  }//permu
                  

                  我唯一不確定的是 sizeof(v)/sizeof(int) 是否正確.

                  The only thing I am not sure of is if sizeof(v)/sizeof(int) is the right way to go.

                  推薦答案

                  sizeof(v)/sizeof(int) 不是要走的路.您的函數完全等同于:

                  sizeof(v)/sizeof(int) is not the way to go. Your function is exactly equivalent to:

                  void permute(int *v, int curr, char *letters)
                  {
                      ...
                  }
                  

                  v 不是真正的數組,它是一個指針.你不能在 C 或 C++ 中傳遞數組.

                  i.e. v is not really an array, it's a pointer. You cannot pass arrays in C or C++.

                  解決方案是以下之一(并非詳盡無遺):

                  The solution is one of the following (not exhaustive):

                  • 添加一個額外的參數來明確描述數組的長度
                  • 添加一個指向數組最后一個元素的額外參數
                  • 使用合適的容器(例如 std::vector),您可以在其上調用 size()
                  • @sehe 建議的模板解決方案
                  • add an extra argument that explicitly describes the length of the array
                  • add an extra argument that points at the last element of the array
                  • use a proper container (e.g. std::vector), which you can call size() on
                  • the template solution that @sehe suggests

                  這篇關于作為函數參數傳遞的數組的大小的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                  When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對象的范圍)
                  Catching exceptions from a constructor#39;s initializer list(從構造函數的初始化列表中捕獲異常)
                  Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區別)
                • <tfoot id='KEb4T'></tfoot>
                      <tbody id='KEb4T'></tbody>

                          <i id='KEb4T'><tr id='KEb4T'><dt id='KEb4T'><q id='KEb4T'><span id='KEb4T'><b id='KEb4T'><form id='KEb4T'><ins id='KEb4T'></ins><ul id='KEb4T'></ul><sub id='KEb4T'></sub></form><legend id='KEb4T'></legend><bdo id='KEb4T'><pre id='KEb4T'><center id='KEb4T'></center></pre></bdo></b><th id='KEb4T'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KEb4T'><tfoot id='KEb4T'></tfoot><dl id='KEb4T'><fieldset id='KEb4T'></fieldset></dl></div>
                          <legend id='KEb4T'><style id='KEb4T'><dir id='KEb4T'><q id='KEb4T'></q></dir></style></legend>

                          • <bdo id='KEb4T'></bdo><ul id='KEb4T'></ul>
                          • <small id='KEb4T'></small><noframes id='KEb4T'>

                          • 主站蜘蛛池模板: 久久久精品网 | 欧美亚洲高清 | 国产韩国精品一区二区三区 | 黄色免费av | 久久亚 | 欧美精品欧美精品系列 | 黄页网址在线观看 | 一区二区中文字幕 | 亚洲女优在线播放 | 国产精品69毛片高清亚洲 | 精品视频一区二区三区 | 五月免费视频 | 国产欧美一区二区三区国产幕精品 | av毛片 | 在线观看黄免费 | 亚洲风情在线观看 | 久久福利网站 | 国产精品日韩一区 | 国产精品99久久免费观看 | 久久精品国产99国产精品 | 天天爱天天操 | 99这里只有精品视频 | 欧美在线 | 91国内精精品久久久久久婷婷 | 日韩一区二区三区在线看 | 婷婷久久精品一区二区 | 在线午夜 | 亚洲视频第一页 | 国产亚洲一区二区三区 | 免费人成在线观看网站 | 综合精品久久久 | 亚洲精品在线免费播放 | 久久久国产一区二区三区 | 午夜视频一区二区三区 | 超碰成人免费观看 | 祝你幸福电影在线观看 | 午夜资源 | 搞av.com | 91一区二区三区在线观看 | 韩日精品一区 | 欧美日韩精品免费 |