Part 18 - Double 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++ double datatype that stores double floating point values.

  1. #include <iostream>
  2. int main()
  3. {
  4. double my_double = 10.1;
  5. std::cout << my_double << std::endl;
  6. return 0;
  7. }

Very simply we create a float and assign a simple value to it and print it.

Let’s compile and link.

  1. g++ -o 0x06_double_primitive_datatype 0x05_double_primitive_datatype.cpp

Let’s run.

  1. ./0x06_double_primitive_datatype

We simply see the following.

  1. 10.1

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

Next week we will debug this very simple example.