vector_allocate

Digital Signal Processing Library

Voice Lab

Program name: Vector_allocate

Language: C

In file: vector_lib.c

Objective: Allocate memory for a vector

Usage: void vector_allocate(double **vector, int vector_width);

Parameters:

  • vector - The pointer to the vector array
  • vector_width - Number of elements in each vector

Mathematical Description:

Comments: Routine is used to allocate memory for a vector

User Comments

Code:

void vector_allocate(double **vector, int vector_width)
{
(*vector) = malloc(vector_width * sizeof(double));
if((*vector) == NULL) {
fprintf(stderr, "Cannot allocate memory for data\n");
exit(1);
}
}