I am learning about pointers.
I was wondering how the memory address is defined in programming. I get different outputs depending on the format I choose for memory address. So I was wondering if it is correct to assume that the format of the memory address is defined by the programmer. I get different results for memory address when I use Serial.print( (long) &ptr1, DEC);
and Serial.print( (long) &ptr1, HEX);
#include <stdio.h>
int counter = 0;
void setup() {
Serial.begin(9600);
int test1 = 10;
float test2 = 3.14159;
char test3[ ] = "This is a character array";
int *ptr1;
float *ptr2;
char *ptr3;
ptr1 = &test1;
Serial.print("The integer value is stored at ");
Serial.print( (long) &ptr1, DEC);
Serial.print("The integer value is stored at ");
Serial.print( (long) &ptr1, HEX);
}
void loop() {
}
My output is:
The integer value is stored in 2296
The integer value is stored in 8f8