DNA Alignment/src/NWalgo.c
int initArray(struct NWArray* myarray, int width, int height){
    myarray->width = width;
    myarray->height = height;
    myarray->size = width*height;

    if ((myarray->array = malloc(myarray->size*sizeof(struct cell*))) == NULL){
        perror("Error allocation array");
        return -1;
    }

    memset(myarray->array, 0, myarray->size*sizeof(struct cell*));
    return 0;
}
/*******************************************************************************
*       int initArray(struct NWArray*, int, int)
*   Initializes NWArray
*   Input : struct NWArray* myarray    :    Pointer over NWArray that is to be
*                                           initialized
*           int width                  :    Width of NWArray
*           int height                 :    Height of NWArray
*
*   Output: int                        :   0 if successful
*                                          -1 if an error occured
*******************************************************************************/
int initArray(struct NWArray*, int, int)
Initializes NWArray
Input : struct NWArray* myarray    :    Pointer over NWArray that is to be
initialized
int width                  :    Width of NWArray
int height                 :    Height of NWArray

int                        :   0 if successful
1 if an error occured
int initArray ( struct NWArray * int int ) Initializes NWArray Input : struct NWArray * myarray : Pointer over NWArray that is to be initialized int width : Width of NWArray int height : Height of NWArray int : 0 if successful 1 if an error occured
int initArray(struct NWArray* myarray, int width, int height){
    myarray->width = width;
    myarray->height = height;
    myarray->size = width*height;
    if ((myarray->array = malloc(myarray->size*sizeof(struct cell*))) == NULL){
        perror("Error allocation array");
        return -1;
    }
    memset(myarray->array, 0, myarray->size*sizeof(struct cell*));
    return 0;
}
int initArray ( struct NWArray * myarray , int width , int height ) { myarray -> width = width ; myarray -> height = height ; myarray -> size = width * height ; if ( ( myarray -> array = malloc ( myarray -> size * sizeof ( struct cell * ) ) ) == NULL ) { perror ( " " ) ; return -1 ; } memset ( myarray -> array , 0 , myarray -> size * sizeof ( struct cell * ) ) ; return 0 ; }
int initArray(struct NWArray*, int, int)
Initializes NWArray
Input : struct NWArray* myarray    :    Pointer over NWArray that is to be
initialized
int width                  :    Width of NWArray
int height                 :    Height of NWArray
int initArray ( struct NWArray * int int ) Initializes NWArray Input : struct NWArray * myarray : Pointer over NWArray that is to be initialized int width : Width of NWArray int height : Height of NWArray