Increment and Decrement Operators in C
📖 Scenario: Imagine you are managing a small shop's inventory. You need to keep track of the number of items available. Sometimes you add new items, and sometimes items are sold. You will use increment and decrement operators to update the item count quickly.
🎯 Goal: You will create a simple C program that uses increment (++) and decrement (--) operators to update the number of items in stock and then display the final count.
📋 What You'll Learn
Create an integer variable called
items with an initial value.Create an integer variable called
restock to hold the number of new items added.Use the increment operator
++ to increase the items count.Use the decrement operator
-- to decrease the items count.Print the final value of
items.💡 Why This Matters
🌍 Real World
Increment and decrement operators are used in many programs to update counters, track quantities, or manage loops efficiently.
💼 Career
Understanding these operators is essential for programming jobs that involve managing data, loops, or real-time updates, such as software development and embedded systems.
Progress0 / 4 steps