commit 5c77bbea3af84d24e7f32c3596805533c4617ea4
parent e2b0edd5d49d75040a9dce45dfec24ec93f344fe
Author: Martin J. Klöckner <martin.cachari@gmail.com>
Date: Mon, 16 Nov 2020 15:19:38 -0300
Added ej10.c & ej17.c
Diffstat:
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/guia02/ej10.c b/guia02/ej10.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+
+#define TM "3M Corporation"
+#define MAXWELL "Maxwell Corporation"
+#define SONY "Sony Corporation"
+#define VERBATIM "Verbatim Corporation"
+
+typedef enum {
+ TM_CORPORATION,
+ MAXWELL_CORPORATION,
+ SONY_CORPORATION,
+ VERBATIM_CORPORATION
+} manufacturer_t;
+
+
+int main(void) {
+ manufacturer_t c;
+ printf("Introduzca un Id. de fabricante: ");
+ c = (getchar() - '0');
+ switch(c) {
+ case TM_CORPORATION:
+ printf(TM"\n");
+ break;
+ case MAXWELL_CORPORATION:
+ printf(MAXWELL"\n");
+ break;
+ case SONY_CORPORATION:
+ printf(SONY"\n");
+ break;
+ case VERBATIM_CORPORATION:
+ printf(VERBATIM"\n");
+ break;
+ default:
+ printf("El numero ingresado no es valido\n");
+ return 1;
+ }
+ return 0;
+}
diff --git a/guia02/ej17.c b/guia02/ej17.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int main(void)
+{
+ #ifdef DEBUG
+ printf("DEBUGGING\n");
+ #endif
+
+ printf("Hello world!\n");
+
+ return 0;
+}
diff --git a/guia02/ej9.c b/guia02/ej9.c
@@ -22,9 +22,15 @@ typedef enum {
FIRST, SECOND, THIRD, FOURTH
} year_t;
+typedef enum {
+ ERROR, OK
+} status_t;
-void clean(char *buffer)
+status_t clean(char *buffer)
{
+ if(buffer == NULL)
+ return ERROR;
+
for(size_t i = 0; i < MAX_LEN; i++)
buffer[i] = '\0';
}