久久久久久久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 仍然相關嗎?)
主站蜘蛛池模板: 香蕉在线观看 | www.4hu95.com四虎| 国产在线a | 日韩毛片免费看 | 国产伦精品一区二区三毛 | 一级片欧美 | 色婷婷成人| 17c一起操| 波多野结衣在线观看一区二区 | 精品在线免费视频 | 亚洲天堂影院 | 日韩精品毛片 | 亚洲va韩国va欧美va精品 | 亚洲性网站| 成人做爰免费视频免费看 | 色播五月婷婷 | av片在线免费观看 | 欧美91视频 | 久草视 | 天天躁日日躁狠狠躁 | 国产在线不卡视频 | 欧美视频在线一区 | 日韩精品视频免费在线观看 | 最新av在线 | 亚洲三区在线 | 日韩精品视频在线免费观看 | 亚洲精品一区中文字幕乱码 | 中文字幕在线不卡 | 91国产丝袜在线播放 | 亚洲激情四射 | 亚洲免费黄色 | 操碰在线视频 | 中文字幕永久在线 | 日韩精品一区二区三区四区 | 国产精品久久久久久久久久 | 黄色av免费在线观看 | 91视频免费观看 | 国产成人在线观看免费网站 | 国产激情视频 | 99在线精品视频 | 精品国产乱码一区二区三 |