Hacker News new | ask | show | jobs
by teo_zero 20 days ago
> int c[] = ..., that is always going to be on the stack

Why? In the following code, only c will be allocated on the stack:

  int a[]={1,2,3};
  foo() {
    static int b[]={1,2,3};
    int c[]={1,2,3};
  }
1 comments

The point is anything that is not dynamically allocated has size known at compile time.