Overview
We will write some C functions that calculate the grand totals as well as the ending balances for raw and cooked transactions. In addition to calculating the grand totals, we need to calculate the totals for each category for display in the pie charts. All of these calculations will be performed in a single C file and compiled down to a single Wasm file that will be instantiated when the application loads. C can be a little daunting for the uninitiated, so our code will be sacrificing some efficiency for the sake of clarity. I'd like to take a moment to apologize to the C/C++ programmers reading this book; you're not going to like what you C.
In order to perform calculations dynamically, we need to allocate and deallocate memory ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access