I am writing a function in C to do some calculations. and I want to return that as an array value to another function this way.
455 calculated_val = calculation(value_perf);
358 int calculation(double* dataset){
359
360 double calculated[8] = {};
361 calculated[0] = dataset[7]/dataset[5];
362 calculated[1] = (dataset[0] + dataset[1] + dataset[2] - dataset[3] - dataset[4])/(dataset[5]);
363 calculated[2] = dataset[3]/dataset[5];
364 calculated[3] = dataset[6]/dataset[5];
365 calculated[4] = dataset[8]/dataset[5];
366 calculated[5] = dataset[9]/dataset[10];
367 calculated[6] = dataset[11]/dataset[5];
368 calculated[7] = dataset[12]/dataset[5];
369 return calculated;
370 }
While, I am doing so..I get the following warnings and I don't understand them.
369:2: warning: return makes integer from pointer without a cast [enabled by default]
369:2: warning: function returns address of local variable [enabled by default]
Is there something I missed out fundamentally? Please give me some hints/solutions.