3 ms·
In C you can declare pointers to arrays, the syntax is just somewhat strange. You can even declare it as a pointer to a variable sized array with c99, eg: vo
by david2ndaccount 6y ago
In C you can declare pointers to arrays, the syntax is just somewhat strange. You can even declare it as a pointer to a variable sized array with c99, eg:
void foo(size_t length, char (*x)[length]){
size_t size = sizeof(*x);
assert(size == length);
printf("sizeof(*x): %zu\n", sizeof(*x));
}
- dependenttypes 6y agoHere is a post from 2014 from someone who is in the C standard committee. https://gustedt.wordpress.com/2014/09/08/dont-use-fake-matrices/ https://gustedt.wordpress.com/2014/09/08/dont-use-fake-matri...