Part 12 - Boolean Primitive Datatype

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/hacking\_c-\_arm64

Today we are going to talk about the C++ boolean datatype that stores either a 0 or 1 to represent 0 for false _and _1 for anything true.

This kind of flag is used extensively in programming in general and we will look at another very basic program to understand its simple usage.

#include <iostream>

    int main()
    {
        bool my_bool = true;

        std::cout << my_bool << std::endl;

        return 0;
    }

We see that we are creating a bool and assigning it a _true _value or _1 _value and printing it.

Let's compile and link.

g++ -o 0x04_asm64_boolean_primitive_datatype 0x04_asm64_boolean_primitive_datatype.cpp

Let's run.

./0x04_asm64_boolean_primitive_datatype

We simply see the following.

1

It successfully echoed 1 to the terminal stdout. Very simple.

Next week we will debug this very simple example.

results matching ""

    No results matching ""