From 4b27b140f03c14e53fa181b3d1a6456f2a3f79c6 Mon Sep 17 00:00:00 2001 From: Roboart Date: Sat, 10 Apr 2021 13:09:35 -0400 Subject: [PATCH] Se agregan los datos del alumno Rodriguez, Osvaldo --- inc/alumnos.h | 2 ++ src/alumnos.c | 9 +++++++++ src/main.c | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/inc/alumnos.h b/inc/alumnos.h index 037a37c..8938c1a 100644 --- a/inc/alumnos.h +++ b/inc/alumnos.h @@ -41,6 +41,8 @@ typedef struct alumno_s { bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno); +bool RodriguezOsvaldo(char * cadena, size_t espacio); + /*=====[Prototypes (declarations) of public interrupt functions]=============*/ /*=====[C++ - end]===========================================================*/ diff --git a/src/alumnos.c b/src/alumnos.c index 45cce7b..5118153 100644 --- a/src/alumnos.c +++ b/src/alumnos.c @@ -46,4 +46,13 @@ bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno) { return (resultado >= 0); } +bool RodriguezOsvaldo(char * cadena, size_t espacio) { + const struct alumno_s alumno = { + .apellidos = "RODRIGUEZ", + .nombres = "Osvaldo Antonio", + .documento = "15.123.345", + }; + + return SerializarAlumno(cadena, espacio, &alumno); +} /*=====[Implementations of private functions]================================*/ diff --git a/src/main.c b/src/main.c index a7e9e9e..79c1dcb 100644 --- a/src/main.c +++ b/src/main.c @@ -35,5 +35,13 @@ /*=====[Implementations of private functions]================================*/ int main(int argc, char *argv[]) { + char cadena[128]; + + if (RodriguezOsvaldo(cadena, sizeof(cadena))) { + printf("Alumno: %s\r\n", cadena); + } else { + printf("No se pudo serializar el alumno\r\n"); + } + return 0; }