Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- typedef struct pallet{
- int id;
- int alturapallet;
- int fecha;
- struct pallet *sig;
- struct pallet *ant;
- } tPallet;
- typedef struct {
- tPallet *head;
- tPallet *tail;
- tPallet *curr;
- unsigned int listSize;
- unsigned int pos;
- } tLista;
- void initList (tLista *B){
- B->curr=(tPallet *)malloc(sizeof(tPallet));
- B->head=B->curr;
- B->head=B->tail;
- B->listSize=0;
- B->pos=0;
- }
- void insert (tLista*B, int valor){
- tPallet *aux = B->curr->sig;
- B->curr->sig=(tPallet *)malloc(sizeof(tPallet));
- B->curr->sig->id=valor;
- B->curr->sig->sig=aux;
- if(B->curr==B->tail) B->tail = B->curr->sig;
- B->listSize++;
- }
- int main(){
- tLista *B=(tLista *)malloc(sizeof(tLista));
- initList(B);
- insert(B,9);
- printf("%d",B->curr->sig->id);
- return 0;
- }
Add Comment
Please, Sign In to add comment