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

帶 for 循環的無符號 int 反向迭代

Unsigned int reverse iteration with for loops(帶 for 循環的無符號 int 反向迭代)
本文介紹了帶 for 循環的無符號 int 反向迭代的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我希望 for 循環中的迭代器變量作為 unsigned int 反向迭代到 0,我想不出與 i > 類似的比較.-1,就像如果它是 signed int 一樣.

I want the iterator variable in a for loop to reverse iterate to 0 as an unsigned int, and I cannot think of a similar comparison to i > -1, as you would do if it was a signed int.

for (unsigned int i = 10; i <= 10; --i) { ... }

但這似乎很不清楚,因為它依賴于無符號整數的數值溢出超過 10.

But this seems very unclear, as it is relying on the numerical overflow of the unsigned integer to be above 10.

也許我只是沒有清醒的頭腦,但有什么更好的方法可以做到這一點...

Maybe I just don't have a clear head, but whats a better way to do this...

免責聲明:這只是一個簡單的用例,10 的上限是微不足道的,它可以是任何東西,并且 i 必須是一個 unsigned int.

Disclaimer: this is just a simple use case, the upper limit of 10 is trivial, it could be anything, and i must be an unsigned int.

推薦答案

可以使用

for( unsigned int j = n; j-- > 0; ) { /*...*/ }

它從 n-1 向下迭代到 0.

It iterates from n-1 down to 0.

這篇關于帶 for 循環的無符號 int 反向迭代的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

What do compilers do with compile-time branching?(編譯器如何處理編譯時分支?)
Can I use if (pointer) instead of if (pointer != NULL)?(我可以使用 if (pointer) 而不是 if (pointer != NULL) 嗎?)
Checking for NULL pointer in C/C++(在 C/C++ 中檢查空指針)
Math-like chaining of the comparison operator - as in, quot;if ( (5lt;jlt;=1) )quot;(比較運算符的數學式鏈接-如“if((5<j<=1)))
Difference between quot;if constexpr()quot; Vs quot;if()quot;(“if constexpr()之間的區別與“if())
C++, variable declaration in #39;if#39; expression(C++,if 表達式中的變量聲明)
主站蜘蛛池模板: 久久精品国产精品青草 | 91毛片在线看 | 成人三级网址 | 91麻豆蜜桃一区二区三区 | 久久免费视频观看 | 欧美jizzhd精品欧美巨大免费 | 久久av影院 | 欧美一级片在线看 | av一区二区三区四区 | 免费一区二区三区在线视频 | 日本在线观看网址 | 国产精品美女久久久久 | a级毛片毛片免费观看久潮喷 | 久久夜色精品国产 | 精品欧美乱码久久久久久 | 国产亚洲高清视频 | 在线看av的网址 | 亚洲欧洲精品成人久久奇米网 | 亚洲免费视频播放 | 婷婷久久久久 | 亚洲精品66| 视频在线一区二区 | 久久久91精品国产一区二区精品 | 日本高清不卡视频 | 视频在线日韩 | 欧美精品一区二区三区一线天视频 | 国产精品日产欧美久久久久 | 亚洲精选一区 | 992人人草 | 午夜视频免费网站 | 色爽女 | 欧美日韩久久精品 | av免费网站在线观看 | 欧美一区二区三区国产 | 精品成人av | 欧美精选一区二区 | 免费成人毛片 | 日本免费黄色一级片 | 婷婷开心激情综合五月天 | 国产高清免费视频 | 中文字幕日韩欧美 |