The parsing always starts with the name and mover to the right until it finds a right parenthesis ) or a semi-colon ;
When either of these is encountered, the parser resumes at the place where it moved right but now it moves left. If a left parenthesis ( or the beginning of the line is encountered, the parser resumes where it left off on the right and moves right.
When the parser reaches the ; the parse is done.
OK. So here we go:
- void(*pf)(int * const pi);
1) Start at the name an move right:
"pf" and we hit a )
2) Position where we started right and move left:
"pf is a pointer" and we hit a (
3) Position where we left off on the right:
"pf is a pointer to a function that takes a const pointer to int" and we hit a )
4) Position where we left off on the left and move left:
"pf is a pointer to a function that takes a const pointer to int and returns void" and we hit a (
5) Position where we left off on the right ad move to the right:
"pf is a pointer to a function that takes a const pointer to int and returns void" and we hit a ;
The parse is done:
"pf is a pointer to a function that takes a const pointer to int and returns void"