/*** --- CellElemFunc --- ---Created by : Naej Doree --- ***/ #include #include #include int main(int argc, char **argv){ } int AddNextCol(cellElement* tree){ cellElement elem = NULL; elem = (cellElement*) malloc(sizeof(cellElement)); if (elem == NULL){ return -1; } printf("---insertNextCol---\n"); elem->value = true; elem->nextCol = NULL; elem->nextRow = NULL; if (tree->nextCol == NULL){ tree->nextCol = elem; return 1; }else{ return -2; } } int AddNextRow(cellElement* tree){ cellElement elem = NULL; elem = (cellElement*) malloc(sizeof(cellElement)); if (elem == NULL){ return -1; } printf("---insertNextRow---\n"); elem->value = true; elem->nextRow = NULL; elem->nextRow = NULL; if (tree->nextRow == NULL){ tree->nextRow = elem; return 1; }else{ return -2; } } void removeNextCol(cellElement* tree){ printf("---removeNextCol---\n"); if (tree->nextCol != NULL){ DLinkedListElement* elem = tree->nextCol; free(elem); elem =NULL; } } void removeNextRow(cellElement* tree){ printf("---removeNextRow---\n"); if (tree->nextRow != NULL){ DLinkedListElement* elem = tree->nextRow; free(elem); elem =NULL; } } void recursivePrint(cellElement * tree){ if (tree != NULL){ printf("Elem : x: %d y: %d \n",tree->colIndex,tree->rowIndex); if (tree->nextCol != NUll){ recursivePrint(tree->nextCol); }else if (tree->nextRow != NUll){ recursivePrint(tree->nextRow); }else{ printf("leaf\n"); } } }