Software & Finance





C Programming (Turbo C++ Compiler) - double array initialization and counting the number of elements





Here is a simple program that is to initialize the array and count the number of elements in the perfect way.  


Source Code


#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

#include <bios.h>

#include <ctype.h>

 

static double numbers[] =

{

        10.11, 10.12, 10.13, 10.14

};

 

void main()

{

        int numElements = sizeof(numbers) / sizeof(numbers[0]);

        for(int i = 0; i <numElements; i++)

                printf("%d\n", numbers[i]);

}

Output


10.11
10.12
10.13
10.14