日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

取地址符和解引用符的区别_(&)和解引用(*)运算符的地址以及C中的指针...

發(fā)布時間:2023/12/1 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 取地址符和解引用符的区别_(&)和解引用(*)运算符的地址以及C中的指针... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

取地址符和解引用符的區(qū)別

Here, we are discussing about the two most useful operators with the pointers, why and how they are used?

在這里,我們用指針討論兩個最有用的運(yùn)算符 ,為什么以及如何使用它們?

1)運(yùn)營商地址(&) (1 ) The Address of Operator (&))

It is an "address of" operator which returns the address of any variable. The statement &var1 represents the address of var1 variable. Since it can be used anywhere but with the pointers, it is required to use for initializing the pointer with the address of another variable.

它是一個“地址”運(yùn)算符 ,它返回任何變量的地址。 語句&var1代表var1變量的地址。 由于它可以與指針一起在任何地方使用,因此需要使用另一個變量的地址來初始化指針 。

2)解除引用運(yùn)算符(*) (2 ) The Dereference Operator (*))

It is used for two purposes with the pointers 1) to declare a pointer, and 2) get the value of a variable using a pointer.

它用于指針的兩個目的:1) 聲明一個指針 ,2) 使用指針獲取變量的值 。

Read more: Accessing the value of a variable using pointer in C

: 使用C語言中的指針訪問變量的值

Example:

例:

#include <stdio.h>int main(void) {//normal variableint num = 100; //pointer variableint *ptr; //pointer initializationptr = &num; //printing the valueprintf("value of num = %d\n", *ptr);//printing the addressesprintf("Address of num: %x\n", &num);printf("Address of ptr: %x\n", &ptr);return 0; }

Output

輸出量

value of num = 100 Address of num: 9505c134 Address of ptr: 9505c138

翻譯自: https://www.includehelp.com/c/the-address-of-and-dereference-operators-with-the-pointers-in-c.aspx

取地址符和解引用符的區(qū)別

總結(jié)

以上是生活随笔為你收集整理的取地址符和解引用符的区别_(&)和解引用(*)运算符的地址以及C中的指针...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。