Labels

Friday, October 19, 2018

Return a array from function in C language

void func1(double a[])
{
   /* code */
}


void func2(void)
{
   /*  double *t = (double *) malloc(sizeof(double)*array_length); */ //c++ 
   double *t = malloc(sizeof(double)*array_length);
   /* remember to free(t) later */
   /* code */
}


double * func3(double a[])
{
   /* code */
   return a;
}


REFERENCE:
https://stackoverflow.com/questions/3473438/return-array-in-a-function

No comments:

Post a Comment