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

C/C++:指針算術

C/C++: Pointer Arithmetic(C/C++:指針算術)
本文介紹了C/C++:指針算術的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 Pointer Arithmetic 中讀了一點,我發現了兩件事我不明白,也不知道它的用途

I was reading a bit in Pointer Arithmetic, and I came upon 2 things I couldn't understand neither know it's use

address_expression - address_expression

還有

address_expression > address_expression

誰能給我解釋一下,它們是如何工作的以及何時使用.

Can someone please explain them to me, how do they work and when they are used.

我想說的是如果我只取兩個地址并減去它們會產生什么

What I meant to say is what do they produce if I just take two addresses and subtract them

如果我取兩個地址并比較它們是什么結果或基于比較

And If I take two addresses and compare them what is the result or comparing based upon

減去地址的結果我現在明白了,但是比較地址還是不明白.

I now understand the result of subtracting addresses, but comparing addresses I still don't get it.

我知道 1<2,但是一個地址如何大于另一個地址以及它們的比較對象是什么

I understand that 1<2, but how is an address greater than another one and what are they compared upon

推薦答案

指針減法產生相同類型的兩個指針之間的數組元素數.

Pointer subtraction yields the number of array elements between two pointers of the same type.

例如

int buf[10] = /* initializer here */;

&buf[10] - &buf[0];  // yields 10, the difference is 10 elements

指針比較.例如,對于 > 關系運算符:如果左側的指向數組元素或結構成員,則 > 操作產生 1在右側的指向數組元素或結構成員之后,否則產生 0.記住數組和結構是有序序列.

Pointer comparison. For example, for the > relational operator: the > operation yields 1 if the pointed array element or structure member on the left hand side is after the pointed array element or structure member on the right hand side and it yields 0 otherwise. Remember arrays and structures are ordered sequences.

 &buf[10] > &buf[0];  // 1, &buf[10] element is after &buf[0] element

這篇關于C/C++:指針算術的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Algorithm to convert RGB to HSV and HSV to RGB in range 0-255 for both(將 RGB 轉換為 HSV 并將 HSV 轉換為 RGB 的算法,范圍為 0-255)
How to convert an enum type variable to a string?(如何將枚舉類型變量轉換為字符串?)
When to use inline function and when not to use it?(什么時候使用內聯函數,什么時候不使用?)
Examples of good gotos in C or C++(C 或 C++ 中好的 goto 示例)
Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);(ios_base::sync_with_stdio(false) 的意義;cin.tie(NULL);)
Is TCHAR still relevant?(TCHAR 仍然相關嗎?)
主站蜘蛛池模板: 日韩在线专区 | 成人在线视频网 | 91久久久精品 | 国产乱码久久久久久 | www国产| 久久亚洲免费视频 | 亚洲精品乱码久久久久久蜜桃91 | 特黄老太婆aa毛毛片 | 国产一区二区三区视频 | 一级片免费在线观看 | 欧美精品国产 | 加勒比综合 | 欧美成人性生活视频 | 日韩一级淫片 | 一区二区精品 | 黄色av免费看 | 亚洲精品久久久久久久久久久 | 久久精品一区二区三区四区五区 | 伊人国产女 | 欧美日本在线 | 成人激情在线 | 精品久久久久久久久久 | 欧美视频一区二区 | 一二三区视频 | 一级国产片 | 日韩精品在线免费观看 | 91在线一区 | 蜜臀av性久久久久av蜜臀妖精 | 亚洲免费久久 | 亚洲成人免费在线 | 精品一区二区三区三区 | 亚洲小视频在线观看 | 欧美一级网站 | 99国产精品99久久久久久 | 日韩精品一区二区三区四区 | 日本伊人网| 91网站免费| 国产区视频在线 | 一级黄色大片 | 午夜aaa| 欧美日韩亚洲一区 |