I've noticed that with most ncurses functions, both in function names and their arguments, y comes before x (getmaxyx(),getparyx(),getyx(), etc), but the opposite is true almost everywhere else. Both in programming languages and math in general.
Why is this?
That matches the order used for the terminal description capability for moving the cursor:
cursor_address cup cm move to row #1 col-
umns #2
For terminals that support cursor-address, you could in principle have row,col or col,row as well as other variations such as using a 1-based set of coordinates:
%i add 1 to first two parameters (for ANSI terminals)
An ANSI terminal uses the row,col ordering, as seen in this fragment used in many terminals:
ansi+cup,
cup=\E[%i%p1%d;%p2%dH, home=\E[H,
That is, cup
is an escape character, followed by [ and the row and column values (p1 and p2) separated by ; and terminated by H.
Why that particular order was chosen for the standard is obscure (about 40 years ago), but it certainly had an effect on the libraries written to use these escape sequences.
Further reading: