pablosotol

Tarea 01 (Dinamico)

Oct 10th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include<stdilib.h>
  2. #include<stdio.h>
  3. #include<stdint.h>
  4.  
  5. struct s_nodo{
  6.  
  7.    uint8_t ID;
  8.    struct s_nodo* v;
  9.    
  10. };
  11.  
  12. typedef struct s_nodo s_n;
  13. typedef struct s_nodo* p_n; //Paso A y Paso B
  14.  
  15. p_n crea_nodo(uint8_t ID){
  16.        
  17.         p_n p;
  18.         p=malloc(sizeof(s_n));
  19.         if(p==NULL){
  20.                 perror("Error en crea_nodo()\n");
  21.                 exit(EXIT_FAILURE);
  22.         }
  23.         p->ID=ID;
  24.         p->v=NULL;
  25.        
  26.         return (p);
  27. }
  28.  
  29.  
  30.  
  31. int main(){
  32.  
  33.     p_n inicio;
  34.     inicio=crea_nodo('A');
  35.     inicio->v=crea_nodo('B');
  36.    
  37.    
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment