Quote Originally Posted by lni View Post
FALSE.

Try this and tell me why it works.
:-)

Explain this:

Qt Code:
  1. #include "stdio.h"
  2. #include <QString>
  3.  
  4. struct A {
  5. int array[1000];
  6. };
  7.  
  8. int main(){
  9. A a;
  10. A *b = new A;
  11. printf("Addr of a: 0x%08x\n", (unsigned int)&a);
  12. printf("Addr of a.array: 0x%08x\n", (unsigned int)a.array);
  13. printf("Addr of b: 0x%08x\n", (unsigned int)b);
  14. printf("Addr of b->array: 0x%08x\n", (unsigned int)b->array);
  15. return 0;
  16. }
To copy to clipboard, switch view to plain text mode 

Result:
txt Code:
  1. Addr of a: 0xbfa5008c
  2. Addr of a.array: 0xbfa50090
  3. Addr of b: 0x089fe1b8
  4. Addr of b->array: 0x089fe1bc
To copy to clipboard, switch view to plain text mode 

As you see a and a.array are on the stack and b and b->array are on heap.

Your "example" works because even if "myStruc" is allocated on the stack, its array member will be allocated on the heap. But it doesn't mean that if myStruc is allocated on the heap, array is (or can be) allocated on the stack