Part 44 – Pre-Decrement Operator

For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial

Let's take a look at our pre-decrement operator example. The pre-decrement operator decrements a given value before the action gets assigned.

Let's examine our code.

#include <iostream>

int main(void) {
    int myNumber = 16;
    int myNewNumber = --myNumber;

    std::cout << myNewNumber << std::endl;
    std::cout << myNumber << std::endl;

    return 0;
}

As we compile and run we see 15 echoed out to the terminal.

The value of myNumber was 16 and when it is assigned with the pre-decrement operator we see that the new value is 15 as it is assigned into myNewNumber.

Next week we will dive into the Debuggin Pre-Decrement Operator.

results matching ""

    No results matching ""