From the course: C Programming for Embedded Applications
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Lookup tables - C Tutorial
From the course: C Programming for Embedded Applications
Lookup tables
- [Instructor] There are several alternatives to traditional functions, and the decision on which to use has an impact on memory, because normal functions use a lot of memory for the stack and the alternatives, well, not so much. It has an impact on storage, because the alternatives perform very well at the expense of space in ROM. And finally, it has an impact on the processing power demand. Lookup tables are the lightest load of all, as we'll see. The first alternative we'll explore are lookup tables. These are constant arrays that contain the return values of a function or operation. And this is done to save the CPU some work. Lookup tables have been in our lives since grade school. One clear example are multiplication tables. If we have to calculate 7 x 8, we're not really adding seven to itself eight times. But instead, we recall this value we already learned. Some calculators have lookup tables to implement…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.