Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 27:eb32f100130f, committed 2019-10-08
- Comitter:
- rgsbuap
- Date:
- Tue Oct 08 18:38:01 2019 +0000
- Parent:
- 26:29f649949409
- Commit message:
- Proyecto de funciones
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 04 16:19:52 2019 +0000 +++ b/main.cpp Tue Oct 08 18:38:01 2019 +0000 @@ -1,36 +1,21 @@ #include "mbed.h" Serial pc(USBTX,USBRX); +//Funcion sin argumento y con retorno -void funcion1(void); //Funcion sin argumento y sin regreso de dato -void funcion2(char);//Funcion con argumento y sin retorno +int funcion3(void); + int main() { - funcion1(); - while (1){ -char variable1; - variable1 = pc.getc(); - funcion2(variable1); -} +int variable; +variable = funcion3(); +pc.printf("La variable retornada es %d \r\n", variable); + } -void funcion1() -{ pc.printf("FUNCION SIN ARGUMENTO Y SIN RETORNO\r\n"); -wait(1); +int funcion3(void) +{ int variable_de_funcion3 = 10; + return variable_de_funcion3; } - -void funcion2(char hola) -{if(hola=='5') -{ - pc.printf("variable es %c", hola); - } -else if(hola == '6') -{ - pc.printf("variable es %c", hola); - } -else{ -pc.printf("FUNCION CON ARGUMENTO Y SIN RETORNO\r\n"); - } - wait(1); }