Part 9 - Character 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 first of the C++ primitive. The char dataype is used to store a single character and must be surrounded by single quotes.

Let’s look at our basic example.

  1. #include <iostream>
  2. int main()
  3. {
  4. char my_char = 'c';
  5. std::cout << my_char << std::endl;
  6. return 0;
  7. }

Extremely simple. We are simply creating a char variable called my_char _and assigning it the character _c.

We then print it to stdout and nothing more.

Let’s compile and link.

  1. g++ -o 0x03_asm64_char_primitive_datatype 0x03_asm64_char_primitive_datatype.cpp

Let’s run.

  1. ./0x03_asm64_char_primitive_datatype

Very simply we see the following.

  1. c

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

Next week we will debug this very simple example.