- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Reference and dereference operator in Arduino
The reference (&) and dereference operators (*) in Arduino are similar to C. Referencing and dereferencing are used with pointers.
If x is a variable, then its address is represented by &x.
Similarly, if p is a pointer, then the value contained in the address pointed to by p is represented by &p.
Example
void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.println(); int x = 10; int *p; p = &x; //p now contains the address of x Serial.print("The value stored in the address pointed by p is: ");Serial.println(*p); } void loop() { // put your main code here, to run repeatedly: }
Output
The Serial Monitor output is −
- Related Articles
- Reference assignment operator in PHP to assign a reference?
- Differences between Method Reference and Constructor Reference in Java?
- Bitwise AND and OR in Arduino
- Logical AND and OR in Arduino
- tone() and noTone() in Arduino
- pulseIn() and pulseInLong() in Arduino
- shiftIn() and shiftOut() in Arduino
- deque::operator= and deque::operator[] in C++ STL
- For and While loops in Arduino
- Square and Square root in Arduino
- Enable and disable interrupts in Arduino
- Explain reference and pointer in C programming?
- Difference between "new operator" and "operator new" in C++?
- Difference Between Pointer and Reference
- What is the difference between a weak reference and an unowned reference?

Advertisements