not able to print integers stored in array , just getting bunch of 0s
below is my code #include<stdio.h> #include<stdlib.h> int size_g; int cm=0; int final_array[10000]; //this is prototype int* data_collect(); int reduce(int a,int b, int c); //you are returning.....pointer to an object..so u need to add the return type as integer pointer-> int* int main() { int* p; p=data_collect(); for ( ; size_g > cm ; cm++) { if (cm>0) { reduce(p[cm],p[cm+1],final_array[cm-1]); } } int f = 0 ; while (f<size_g) { printf("%d",final_array[f]); f++; } return -1; } int* data_collect() { int k,i=0; printf("how many numbers you want to enter this time\n"); scanf("%d",&size_g); int* array_i=(int*)malloc(size_g*sizeof(int)); while(i<size_g) { printf("Enter the number : "); scanf("%d",&array_i[i]); ++i; } return array_i; } int reduce(int a , int b, int c) { c = a+b ; return c ; }