Your
scanf
statement is wrong. Array names are already pointers so do not need the
addressof (&)
operator:
while (scanf("%s %s", &op, &buf) == 2)
while (scanf("%s %s", op, buf) == 2)
You also need to flush the input for the next
scanf
, as there will still be a newline character to be read.