Browse Source

added prototype for eval() function; added comment for saferFree() function

master
T. Meissner 11 years ago
parent
commit
ec9a4516b8
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      c_pointers/chapter_3.c

+ 2
- 0
c_pointers/chapter_3.c View File

@ -24,6 +24,7 @@ void err(void);
int operation(t_fptr_op op, int a, int b);
t_fptr_op select(int opc);
void initialiseOperationsArray(void);
int eval(int opc, int a, int b);
int evalArray(int opc, int a, int b);
t_fptr_op operations[128] = {NULL};
@ -54,6 +55,7 @@ void allocateArrayWrong(int *arr, int size, int value) {
// safer free version which checks for NULL pointer
// assigns NULL after freeing the pointer
// hint: check for null before free() isn't neccessary
void saferFree(void **pointer) {
if (pointer != NULL && *pointer != NULL) {
free(*pointer);


Loading…
Cancel
Save