Ver Mensaje Individual
  #11 (permalink)  
Antiguo 09/07/2010, 17:26
iwkillyou
 
Fecha de Ingreso: julio-2010
Mensajes: 153
Antigüedad: 13 años, 9 meses
Puntos: 1
Respuesta: pasar una estructura por referencia

un ejemplo echo a lo rapido para pasar por referencia una estructura
Código C:
Ver original
  1. #include <stdio.h>
  2.  #include <string.h>
  3.  struct Estructura
  4.  {
  5.      char nombre[10];
  6.      char tel[10];
  7.  };
  8.  
  9.  void funcion(struct Estructura *estructura);
  10.  
  11.  int main(int argc, char **argv)
  12.  {
  13.      struct Estructura estructura;
  14.      strcpy(estructura.nombre, "nombre");
  15.      strcpy(estructura.tel, "tel");
  16.      
  17.      funcion(&estructura);
  18.  }
  19.  
  20.  void funcion(struct Estructura *estructura)
  21.  {
  22.      printf("nombre:%s - tel: %s\n", estructura->nombre, estructura->tel);
  23.      
  24.  }