久久久久久久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 仍然相關嗎?)
主站蜘蛛池模板: 亚洲精品久久久一区二区三区 | 亚洲福利在线视频 | 久久99精品久久久久久琪琪 | 精品一区二区三区四区五区 | 亚洲国产视频一区 | 精品亚洲一区二区三区 | 很黄很污的网站 | 国产一区二区在线免费播放 | 欧美日韩国产一区二区三区 | 亚洲一区二区三区在线视频 | 国产精品18久久久久久白浆动漫 | 成人午夜激情 | 一级毛片免费 | 操久久久| 草久久久| 毛片视频网站 | 国产精品久久久久久妇女6080 | 日本在线播放一区二区 | 日日噜噜夜夜爽爽狠狠 | 国产视频一区二区 | 日韩一二区 | 激情六月丁香 | 精品一区二区三区免费毛片 | 在线免费观看黄网 | 天天操伊人| 日本二区在线观看 | 91精品国产乱码久久久久久 | 国产精品美女久久久av超清 | 国产精品久久久久久久久免费樱桃 | 色视频网站免费 | 日本一级淫片免费啪啪3 | 久久av一区二区三区 | 99久久精品一区二区毛片吞精 | 日韩成人在线电影 | 国产极品车模吞精高潮呻吟 | 麻豆精品国产91久久久久久 | 久久久看 | 高清黄色毛片 | 欧美福利 | 午夜视频在线免费观看 | 韩日av片|