Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I mean like you can pass it through a function by using the “array syntax” when defining the parameter and making the size a template parameter. Like so:

  template <size_t N>
  void foo(int bar[N])
And this gives you the size without an additional size parameter as you’d usually need in C (of course with the limitation that the parameter now has to be a compile-time sized array).


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: