dimanche 29 mars 2015

What is the difference between the address stored and displayed in C and C++?


In C, if I make a variable and print its address like this:



int a;
int main (void) {
printf ("%p", &a);
return 0;
}


The output was: 00AA


The same program in C++ using the line:



cout << &a << endl;


The output was: 0x8f970aa


What is the difference between these two?


I compiled both the programs using Turbo C.




Aucun commentaire:

Enregistrer un commentaire