title: Passing struct* and loading the struct in other function
body: <p>It doesn't compile, I don't know exactly what I'm doing wrong. When I try to do:</p>
  
  <pre><code>(ultimo-&gt;siguiente)=nnodo; 
  </code></pre>
  
  <p>the compiler doesn't let me. Neither does work: </p>
  
  <pre><code>scanf("%d", &amp;(nnodo-&gt;dni));
  </code></pre>
  
  <p>PD: baja and modif functions are still not done but they shouldn't make any conflicts with the main program.</p>
  
  <hr>
  
  <p>Compiler Output(Visual Studio 2010):</p>
  
  <p>Error   2   error C2037: left of 'siguiente' specifies undefined struct/union 'stru'    c:\documents and settings\emiliano\desktop\asdc.c   52  1   abm</p>
  
  <p>Error   3   error C2037: left of 'dni' specifies undefined struct/union 'stru'  c:\documents and settings\emiliano\desktop\asdc.c   55  1   abm</p>
  
  <p>4   IntelliSense: pointer to incomplete class type is not allowed   c:\documents and settings\emiliano\desktop\asdc.c   52  3   abm</p>
  
  <p>5   IntelliSense: pointer to incomplete class type is not allowed   c:\documents and settings\emiliano\desktop\asdc.c   55  15  abm</p>
  
  <hr>
  
  <p>I think I did the typedefs correctly, but I really do not know.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef struct stru* pstru;
  
  typedef struct{
      int dni;
      pstru siguiente;
  }stru;
  
  
  
  pstru alta(pstru ultimo);
  pstru baja(pstru ultimo);
  pstru modif(pstru ultimo);
  int menu(pstru ultimo);
  
  int main(){
      pstru ultimo;
      ultimo=(pstru)malloc(sizeof(stru));
  
      menu(ultimo);
      return 0;
  }
  
  int menu(pstru ultimo){
  
      int opc;
      printf("Para alta (1), para baja (2), para modif (3), para salir (4)\n");
      scanf("%d", &amp;opc);
  
      switch(opc){
          case 1:
              ultimo=alta(ultimo);
              break;
          case 2:
              ultimo=baja(ultimo);
              break;
          case 3:
              ultimo=modif(ultimo);
              break;
          case 4:
              return 0;
      }
      menu(ultimo);
      return 0;
  }
  
  pstru alta(pstru* ultimo){
      pstru nnodo;
      nnodo=(pstru)malloc(sizeof(stru));
      (ultimo-&gt;siguiente)=&amp;nnodo;
  
      printf("Ingrese DNI\n");
      scanf("%d", &amp;(nnodo-&gt;dni));
  
      ultimo=nnodo;
  
      return ultimo;
  }
  
  pstru baja(pstru ultimo){
      return ultimo;
  }
  
  pstru modif(pstru ultimo){
      return ultimo;
  }
  </code></pre>