typedef char Data; struct node { Data d; struct node * left; struct node * right; }; typedef struct node Node; typedef Node * Bin_tree; extern Bin_tree new_node(void); extern Bin_tree init_node(Data d, Bin_tree p1, Bin_tree p2); extern Bin_tree create_tree(Data a[], int i, int size); extern void preorder(Bin_tree root); extern void inorder(Bin_tree root); extern void postorder(Bin_tree root); |
PREORDER g d b a c f e i h j INORDER a b c d e f g h i j POSTORDER a c b e f d h j i g |
int i, n=20; for (i = 0; i < n; i--) printf("-"); |
double res, x, * p; res = x/*p; |
== is a single token Whereas = = are two tokens a---b is the same as a -- - b But not a - -- b |
i = hi*16+lo; |
i = hi << 4 + low; |
i = (hi << 4) + low i = hi << 4 | low; |
int calc_max(int *x, int size) { for ? { if (x[i] > big); big = x[i]; } } |
if (x[i] > big) {} big = x[i]; |
if (x == 0) if (y == 0) error(); else { z = x + y; f(z); } |
if (x == 0) if (y == 0) error(); else { z = x + y; f(z); } |
#define MAX(a,b) (((a)>(b)) ? (a) : (b)) int a[4]; int biggest; biggest = x[0]; i = 1; while (i < 4) biggest = MAX(biggest, x[i++]); |
#define MAX(a,b) (((a)>(b)) ? (a) : (b)) int a[4]; int biggest; biggest = x[0]; i = 1; while (i < 4) biggest = (biggest > x[i++]) ? biggest : x[i++]; |
assert(x > y); /* should print info only if x <= y */ |
#define assert(e) if (!(e)) assert_error(__FILE__,__LINE__) |
if ((x > 0) && (y > 0)) assert(x > y); else assert(y > x); |
#define assert(e) { if (!e) assert_error(__FILE__,__LINE__) } |
if ((x > 0) && (y > 0)) { if (!(x > y)) assert_error(__FILE__,__LINE__) }; else { if (!(y > x)) assert_error(__FILE__,__LINE__) }; |
#define assert(e) ((void)((e) || assert_error(__FILE__,__LINE__))) |
void fnc(int * pi) { int i; return &i; } |
unsigned char ch; for (ch = 0; ch <= UCHAR_MAX; ch++) |
unsigned int size = 10; while (--size >= 0) { |
while (ptr != NULL) { free(ptr); ptr = ptr->next; } |
char *r; r = malloc(strlen(s)+strlen(t)); strcpy(r, s); strcat(r, t); |
char *r; r = malloc(strlen(s)+strlen(t)+1); if (!r) { /* print some error and exit */ exit(1); } strcpy(r, s); strcat(r, t); /* later */ free(r); r = NULL; /* Try to reset free'd pointers to NULL */ |