Ejemplo n.º 1
0
int main(int argc, char **argv) {
	both_null();
	pattern_null();
	text_null();
	pattern_larger_than_text();
	both_empty();
	empty_pattern();
	empty_text();
	all_match();
	no_match();
	non_overlapping_match();
	overlapping_match();
}
Ejemplo n.º 2
0
int main(void) {
  char ch, popped;
  
  printf("Enter parentheses and/or braces: ");
  
  while ((ch = getchar()) != '\n') {
    if (ch == '(' || ch == '{') {
      push(ch);
    } else {
      popped = pop();
      if (popped == '(' && ch != ')')
        no_match();
      else if (popped == '{' && ch != '}')
        no_match();
    }
  }
  
  if (!is_empty()) {
    no_match();
  } else {
    printf("Everything matches!\n");
  }
}
Ejemplo n.º 3
0
void stack_underflow(void) {
  no_match();
}