 Consider a store that gives reward points with your purchases. For each item you purchase, you get 10% of the price rounded up to the nearest integer in reward points. You also get one bonus point for your first item. After buying the first item, your subtotal is $7 and you have two reward points. Let's say your next item costs $30. You get 3 reward points, 10% of $30. And because this is your second item, you get 2 bonus points. Now your total is $37 and you have 7 reward points total. If your third item is $12, you get 2 reward points, 10% of $12 rounded up, and 3 bonus items for the third item. In other words, every new item you buy gets you an additional bonus reward point. Let's run the program and enter 3 purchases each worth $7. You can see that the reward points increase by 1 each time. Looking at the code, we create all of our variables and repeatedly ask the user for the item price. If it's greater than zero, we add it to the running total, calculate the reward points for that price and save it in a variable for later use, and add it to our total rewards. After each transaction, we let the user know what their current status is and we keep doing this as long as the price they enter is not equal to zero. Let's examine the function that calculates the reward points. There's a constant for the percentage that makes our code more readable. Here's the calculation of the points based on the price. The ceiling function from math.h does the rounding up for us and the cast gets rid of any decimal places for assignment to the integer-based points. We then add one to the number of bonus points and return the base points plus the bonus points. In this program, the bonus points variable is global. It has to be. If it were a local variable, then it would get reset to zero every time we called the function and the value wouldn't accumulate. If we build the program and execute it this way, when we have our three items at $7 each, the extra bonus points never accumulate. But as a global variable, bonus points is exposed to every other function in the program, and who knows if some other programmer might come along and modify the program and accidentally make unwanted changes to that variable. What we really want is to have a variable that's local, but one that keeps its value across function calls. And we can do exactly that by saying that this is a static variable. Static variables are initialized when the program starts, as if they were globals. And like globals, they keep their value from one function call to the next. But because bonus points has been declared inside of this function, the name is local to the function and nobody else can access it. When we build and run, we see that our reward points accumulate exactly as before. And that's when you use static variables. When you need a variable that's local in scope so it can't be accessed from other functions, but you also need it to retain its value across function calls as if it were global.