AlexisRuiz

estructuras en c

Nov 7th, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5.  
  6. struct Datos{
  7. char nombre[30];
  8. char e_mail[30];
  9. int edad;
  10.  
  11. };
  12.  
  13. void Rellenar_datos (Datos amigo[]){///<---aqui error
  14.  
  15. for(int i=0;i<3;i++){
  16. printf("Cual es tu nombre:\n");
  17. fflush(stdin);
  18. gets(amigo[i].nombre);
  19.  
  20. printf("Cual es tu email:\n");
  21. fflush(stdin);
  22. gets(amigo[i].e_mail);
  23.  
  24. printf("Cual es tu edad:\n");
  25. scanf("%d",&amigo[i].edad);
  26. }
  27. }
  28.  
  29.  
  30. void Imprimir_datos(Datos amigo[]){
  31. for(i=0;i<3;i++){
  32. printf("El nombre es:%s\n",amigo[i].nombre);
  33. printf("El email es:%s\n",amigo[i].e_mail);
  34. printf("La edad es:%d\n",amigo[i].edad);
  35. }
  36. }
  37.  
  38. int main()
  39. {
  40.  
  41.   struct  Datos amigo[3];///Declaramos un tipo de variable arreglo llamado amigo
  42.     Rellenar_datos(amigo);
  43.     Imprimir_datos(amigo);
  44.  
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment