Created
April 13, 2020 15:10
-
-
Save parzibyte/30264312aed6e9be0f1dca6221731876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
____ _____ _ _ _ | |
| _ \ | __ \ (_) | | | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___ | |
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \ | |
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/ | |
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___| | |
__/ | __/ | | |
|___/ |___/ | |
Blog: https://parzibyte.me/blog | |
Ayuda: https://parzibyte.me/blog/contrataciones-ayuda/ | |
Contacto: https://parzibyte.me/blog/contacto/ | |
Copyright (c) 2020 Luis Cabrera Benito | |
Licenciado bajo la licencia MIT | |
El texto de arriba debe ser incluido en cualquier redistribución | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
// Se debe incluir con "" y no con <>, para que busque de manera relativa | |
#include "tinyexpr.h" | |
#include "tinyexpr.c" | |
int main() { | |
/* | |
En la siguiente expresión hay un error | |
intencional | |
*/ | |
char *expresion = "2^3 * "; | |
int err = 0; | |
double resultado = te_interp(expresion, &err); | |
if (err != 0) { | |
printf("Hay un error en la expresión cerca de la columna %d\n", err); | |
return EXIT_FAILURE; | |
} | |
printf("%s es: %f", expresion, resultado); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment