久久久久久久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 仍然相關嗎?)
主站蜘蛛池模板: 69堂永久69tangcom| 91porn在线观看 | 日日碰碰| 国产一区二区三区色淫影院 | 久久一区二区三区四区 | 亚洲国产精品久久久久婷婷老年 | 亚洲精品中文字幕在线观看 | av毛片| 国产一二三视频在线观看 | 欧美一区二区三区久久精品 | 色网站在线 | 国产成人久久久 | 国产精品久久久一区二区三区 | 免费a v网站 | 日韩精品一区二区三区视频播放 | 91精品国产自产在线老师啪 | 日韩av啪啪网站大全免费观看 | 国产成人久久精品一区二区三区 | 日韩视频精品 | 久久国产精品视频 | 亚洲国产成人在线视频 | 91影库| 国产一区免费视频 | 国产精品一区二区久久 | 欧美日韩精品久久久免费观看 | 欧洲一区在线观看 | 中文字幕在线观看国产 | 国产精品久久久久久久久久免费看 | 亚洲资源在线 | 日韩视频一区在线观看 | 亚洲成人精品在线观看 | 亚洲一区视频 | 热久久免费视频 | 一本大道久久a久久精二百 国产成人免费在线 | 国户精品久久久久久久久久久不卡 | 一区二区三区四区在线视频 | 国产精品成人品 | 污污免费网站 | 精品一区av | 国产在线一区二区 | 天天操天天射综合 |