***Learn to program and prototype with Arduino now! Join our membership.***
***We designed this circuit board for beginners!***
Kit-On-A-Shield:
FOLLOW US ELSEWHERE
---------------------------------------------------
Facebook:
Twitter:
Website:
________________________________
So let me ask, what is a pointer? Well, a pointer is a variable that holds the memory address of another variable. Hmm, okay, let’s break this statement down. The first part says, a pointer is a variable. Now, hey, I kinda like this part the best, because probably like you, I’m super familiar with variables. In the Arduino programs that I write, I use variables all the time like a constant byte variables for pin numbers or integer variables for different sensor readings or float variables for some type of precise calculation. I mean, the list goes on. I mean, variables are everywhere in my code. Well, pointers are variables too. So you might actually know a lot more about pointers than you actually realize. So let’s talk about a couple things. First, pointers point to a specific data type. So just like an integer variable is designed to hold integer values and not like float values, an integer pointer is designed to point to an integer variable, not a float variable. Declaring a pointer is super similar to declaring any other variable. If I wanted to declare a float variable, I need the data type and the name of the variable, like float temperature, right? So now I got a variable called temperature and it’s gonna hold a float value. If I want to declare a pointer, I need the data type the pointer variable will point to, the name of the pointer variable and an asterisk right before the name. So here we have a pointer pData that will point to an integer variable. Now listen, I know what you’re thinking. What the heck is that asterisk for? That asterisk is called the dereferencing operator. It’s also known as the indirection operator. It’s used when declaring a pointer so that the Arduino IDE knows that this is no regular variable that this is a pointer variable. And as you’ll learn, pointer variables get handled differently than normal variables. And the asterisk tells the Arduino ID, “Hey, I’m not just some regular variable, I’m a pointer variable.“ So anytime you declare a pointer variable you need to use that asterisk in front of the pointer variable’s name. Pointers also have the same naming rules as variables. The name of the pointer can be composed of upper and lowercase letters, digits and underscores. You can’t start the name of a pointer variable with a digit and you can’t use any reserved keywords for the pointer name like int or true. One final thing to point out about this naming. Do you notice I started the name of the example pointer with a lowercase P? By convention, the name of a pointer starts with either a lowercase P or ptr, followed by the name of the variable it points to. This is meant to help inform the people reading the code that, hey, this must be a pointer variable because it starts with a lowercase P. So if we have an integer variable named data then by convention, a pointer to this integer variable would be named pData or ptrData. Again, a convention is just something everybody kind of agrees upon. If you do it differently in your code your code is still gonna run okay, but other developers who read your code may get a little confused. All right, so let’s review what we know about pointers so far. Pointers are variables. Every pointer must point to a specific data type. When declaring a pointer, you use an asterisk before the name. Pointer variables have the same naming restrictions as normal variables. By convention, Pointer names start with a P followed by the name of the variable they point to. All right, so now you know that a pointer is a variable that holds the memory address of another variable. This is a really important idea to try to get in your head but you’re probably really fuzzy about, well what is a memory address and what is the use of a pointer? I’m not sure I get any of this. That is perfectly alright. This is kind of gonna be a a long discussion that we have as we develop the understanding of what pointers are and how to use them. In the next lesson, we’re gonna start talking a little bit more about memory addresses.
***About Us:***
This Arduino lesson was created by Programming Electronics Academy. We are an online education company who seeks to help people learn about electronics and programming through the ubiquitous Arduino development board.
***We have no affiliation whatsoever with Arduino LLC, other than we think they are cool.***
1 view
255
78
17 hours ago 01:05:40 11
Out of Body Encounters with Non-Human Intelligence in Multiple Dimensions
2 days ago 00:06:40 6
English Christian Song | “You Should Understand God’s Intentions“
2 days ago 00:09:42 1
Exposing The Dark,Luxurious & Secretive Lives Of Yachting & Yacht Girls!
2 days ago 00:06:27 1
How to increase followers on Instagram🚀Free Instagram Followers❤️(Working 100%✅)
3 days ago 00:02:27 1
Pokemon GO Spoofing iOS & Android - UPDATED Spoofing Pokemon GO with Joystick, Teleport, Auto Walk
6 days ago 00:01:01 1
vfxAlert - Professional Trading Signals for Binary Options
6 days ago 00:01:03 5
Greta Thunberg accuses Israel of kidnapping her and fellow aid boat crew
1 week ago 00:23:14 83
SIGN OF GOD? See What JUST HAPPENED In The USA Shocked All Warned About This...
1 week ago 00:45:00 5
“Most People Have No Idea What’s About To Happen“ - Richard Wolff’s Last WARNING
1 week ago 00:26:20 1
Lebanon Like You’ve Never Seen It – Mountain Life by Car
1 week ago 00:23:53 1
Continuity of Agenda: Trump Administration White-Washes Bush-Obama-Biden-backed Al-Qaeda in Syria
2 weeks ago 00:20:27 1
System of a Down if They Were a 1970s Hard Rock Band | System of a Crown
2 weeks ago 00:02:13 1
Baseball 9 Hack/MOD APK iOS & Android - How to Get Baseball 9 Free Gems and Coins
2 weeks ago 00:02:19 1
Gen V Season 2 - Teaser Trailer | Prime Video
2 weeks ago 00:02:18 1
Pokemon GO Spoofer iOS & Android - How to Spoof Pokemon GO 2025
2 weeks ago 00:31:28 5
Who’s Truly To Blame For The Russia-Ukraine War? The FULL Story
2 weeks ago 00:02:43 2
Charlie’s Angels: MIND CONTROL (Episode 1)
2 weeks ago 00:05:35 2
Original “Pope Trump“ video - Trump Predicted It?! The First American Pope is REAL Now 🍔⛪
2 weeks ago 00:02:42 2
Hood Dreams 3: World Leaders Go Gang Mode in the Wildest AI Rap War Ever
3 weeks ago 00:22:27 17
#033 Learn Ten Home-Based Exercises and Pain Relief Positions for Lumbar Spinal Stenosis
3 weeks ago 00:02:16 1
Spoofing Pokemon GO iOS & Android - UPDATED Pokemon GO Spoofing with Joystick, Teleport, Auto Walk
3 weeks ago 00:06:37 1
Pink Floyd - “Another Brick in The Wall “ PULSE Remastered 2019
3 weeks ago 00:02:12 1
Los Santos Street Life – A Day in the Hood 🏙️🔥 | GTA V Online
3 weeks ago 00:02:09 1
Monopoly GO Hack iOS & Android - How to Get Monopoly GO Free Dice Rolls 2025