-5

Are there differences between pointers to object stored on stack and heap ? Are there internal representation in common C/C++ compilers (or JVM/LLVM) differs ?

this is very interesting question somehow related to main : memory location patterns on stack and heap

Community
  • 1
  • 1
Qbik
  • 5,460
  • 13
  • 52
  • 86

2 Answers2

3

A pointer is a pointer. No matter where it points to.

I mean: you can assign to the same pointer both the address of a region on the stack and on the heap, don't you? So there cannot be any intrinsic difference between a pointer pointing here or there.

Paolo M
  • 11,983
  • 6
  • 54
  • 72
-2

The difference being ones on the stack you do not need to free

Ed Heal
  • 57,599
  • 16
  • 82
  • 120