4 ms·
It's also worth pointing out that there are no array parameters. If you write void foo (char bar [42]) { // ... } then within the scope of foo
by sjolsen 11y ago
It's also worth pointing out that there are no array parameters. If you write
void foo (char bar [42]) {
// ...
}
then within the scope of foo, bar will be a pointer to char, not an array of char. You can, on the other hand, write
void foo (char (*bar) [42]) {
// ...
}
in which case bar will be a pointer to array of 42 char (and notably, not a pointer to a pointer to char!).
C does some very strange things. There usually is (or at least was) a good reason for it to do so, but especially if you're a beginner, you need to be on your toes if you really want to use it well.