This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define CLEAR_INPUT while (getchar () != '\n') /*void*/ | |
#define CLEAR_SCREEN printf ("\x1b[3;J\x1b[H\x1b[2J") | |
int* create_matrix(int h, int w){ | |
int* tmp_mtx = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int GetNodeHeight ( bstNode *node ) { | |
int height_left = 0; | |
int height_right = 0; | |
if( node->left ) height_left = GetNodeHeight ( node->left ); | |
if( node->right ) height_right = GetNodeHeight ( node->right ); | |
return height_right > height_left ? ++height_right : ++height_left; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
typedef struct bstNode{ | |
int data; | |
struct bstNode* left; | |
struct bstNode* right; | |
}bstNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int buffer[20]; | |
int *pbuffer = buffer; | |
for(int i=0; i<sizeof(buffer); i++) { | |
*(pbuffer++) = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SecFree (void** memRef) { | |
if (memRef != NULL && *memRef != NULL){ | |
free (*memRef); | |
*memRef = NULL; | |
} | |
} | |
//usage | |
secFree ((void** ) &memRef); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
typedef struct bstNode { | |
int data; | |
struct bstNode* left; | |
struct bstNode* right; | |
}bstNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char desenha_tabuleiro(int tam_linhas, int tam_colunas){ | |
char tabuleiro[tam_linhas][tam_colunas]; | |
int j,i; | |
//PREENCHE TABULEIRO COM * | |
for (j = 0; j < tam_linhas; j++) | |
for (i = 0; i < tam_colunas; i++) |