4 ms·
void (*fn)(int*) // fn takes a pointer-to-an-int and gives you void Wouldn't this suggest that the type this function takes is `int*`? I've always thought the
by jotux 10y ago
void (*fn)(int*) // fn takes a pointer-to-an-int and gives you void
Wouldn't this suggest that the type this function takes is `int*`?
I've always thought the pointer declaration syntax in C was just an oversight and I get around it's ambitiousness by always declaring variables on their own line.
- bluetomcat 10y agoAs the article says, int-star is an "abstract declarator". An abstract declarator simply omits the name, otherwise it is the same. Therefore, the "canonic" way to write that declaration would be: void (*fn)(int *);