4 ms·
The irony is that arrays in C are in fact generic. As that is the simplest generic solution that doesn't require boiling the ocean first, that's what many progr
by gpderetta 1y ago
The irony is that arrays in C are in fact generic. As that is the simplest generic solution that doesn't require boiling the ocean first, that's what many programmers reach for.
- deleted 1y ago[deleted]
- monkeyelite 1y agoHow do I write a C function which operates on array of type T? Which generic operations does the language provide?
- gpderetta 1y agoArrays are generic, but of course C doen't provide generic functions. You can generically copy arrays [1], index them, iterate them, compute their size. But that's not the point, the point is that you can instantiate them for any (complete) T. [1] well, C is weird, so you first need to wrap them in a struct.