c programming tips and tricks

Initialize a 2-D Array with a Long List of Values

It can be easily achieved by keeping the list values into a file and then store the file content into the 2-D array with the following line of code.

double array[SIZE][SIZE] = {
    #include "float_values.txt"

Leave a Reply

Your email address will not be published. Required fields are marked *