-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,885
  • 14
  • 62
  • 93

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
  • 12,403
  • 6
  • 52
  • 73
-2

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

Ed Heal
  • 59,252
  • 17
  • 87
  • 127