double c++ code example

Example 1: double to float c++

double v1 = 20120313.0;
    float v2 = (float) v1;

Example 2: float in c++

float contains less storage than a double. 
float p = 25.0;
double p = 25.0;

Example 3: double pointers C++

#include <stdio.h>

int main(void)
{
    int value = 100;
    int *value_ptr = &value;
    int **value_double_ptr = &value_ptr;

    printf("Value: %d\n", value);
    printf("Pointer to value: %d\n", *value_ptr);
    printf("Double pointer to value: %d\n", **value_double_ptr);
}

Tags:

Css Example