Refactored docs.

This commit is contained in:
Lewis Van Winkle
2016-01-24 21:19:48 -06:00
parent 0dcd120d51
commit dc643905d1
2 changed files with 97 additions and 93 deletions

View File

@@ -20,20 +20,19 @@ int main(int argc, char *argv[])
int err;
te_expr *n = te_compile(expression, vars, 2, &err);
if (!err) {
if (n) {
/* The variables can be changed here, and eval can be called as many
* times as you like. This is fairly efficient because the parsing has
* already been done. */
x = 3;
y = 4;
const double r = te_eval(n); printf("Result:\n\t%f\n", r); }
else {
x = 3; y = 4;
const double r = te_eval(n); printf("Result:\n\t%f\n", r);
te_free(n);
} else {
/* Show the user where the error is at. */
printf("\t%*s^\nError near here", err-1, "");
}
/* te_free is safe to call on null. */
te_free(n);
return 0;
}