[指针访问运算符]
说明
引用是专门用于指针的函数之一。与号运算符&
用于此目的。如果 x
是变量,则 &x
表示变量 x
的地址。
示例代码
int *p; // declare a pointer to an int data type
int i = 5;
int result = 0;
p = &i; // now 'p' contains the address of 'i'
result = *p; // 'result' gets the value at the address pointed by 'p'
// i.e., it gets the value of 'i' which is 5
注意事项和警告
指针是初学者学习 C 的复杂科目之一,可以在没有遇到指针的情况下编写绝大多数 Arduino 草图。但是对于操作某些数据结构,使用指针可以简化代码,并且操作指针的知识在一个人的工具包中很方便。
相关用法
- Arduino &用法及代码示例
- Arduino &&用法及代码示例
- Arduino &=用法及代码示例
- Arduino long用法及代码示例
- Arduino Arduino_EMBRYO_2 - setLengthXY()用法及代码示例
- Arduino ~用法及代码示例
- Arduino ArduinoBLE - bleDevice.advertisedServiceUuidCount()用法及代码示例
- Arduino const用法及代码示例
- Arduino Ethernet - server.begin()用法及代码示例
- Arduino ArduinoBLE - BLEService()用法及代码示例
- Arduino digitalWrite()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.subscribe()用法及代码示例
- Arduino Servo - attach()用法及代码示例
- Arduino write()用法及代码示例
- Arduino Arduino_LSM9DS1 - readGyroscope()用法及代码示例
- Arduino ArduinoSound - FFTAnalyzer.input()用法及代码示例
- Arduino MKRGSM - gprs.attachGPRS()用法及代码示例
- Arduino WiFiNINA - WiFi.config()用法及代码示例
- Arduino MKRGSM - sms.read()用法及代码示例
- Arduino MKRNB - getCurrentCarrier()用法及代码示例
- Arduino Scheduler - Scheduler.startLoop()用法及代码示例
- Arduino Arduino_LSM9DS1 - magneticFieldAvailable()用法及代码示例
- Arduino MKRWAN - available()用法及代码示例
- Arduino ArduinoBLE - BLE.poll()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.hasDescriptor()用法及代码示例
注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 &。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。