that exact example is given in the document and presented as 1 of 2 possible solutions. I believe, the critique in the parent comment was unwarranted, but I thought I maybe missed something.
This is the only proper way of doing that. Having pointers to variables on input that functions modify is ugly and error prone. C gets a lot better the moment you try to make your functions as pure as you can.
As long as you don't return structs, as the compiler may introduce memcpys here. C doesn't have C++'s RVO, last time I checked many cases that GCC and Clang did optimize in C++ weren't optimized in C.
That works, at the expense of possibly hiding bugs in plain sight. Macros are a double edged sword in that sense, you can almost but not quite create a DSL on top of C that is a lot more safe but it has its drawbacks, and you need to be very good at mentally modeling macro expansion to read and debug code like that in order to ensure that it does what it seems to be saying that it will do.