Guest User

Untitled

a guest
Jun 24th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.20 KB | None | 0 0
  1.   dPtr1 = dList->front->forw; //tracks the DLN we are building the SLL for
  2.     dPtr2 = dList->front->forw; //tracks the location of the desired DLN data
  3.  
  4.     while(i<count)
  5.     {
  6.         sPtr = NULL;
  7.         printf("%d\n", i);
  8.  
  9.         j=0;
  10.         while(j<count) //build SLL
  11.         {
  12.             fscanf(fptr, "%d", price);
  13.             printf("\t%02d price: %d\n", j, price);
  14.  
  15.             if(price != 0)
  16.             {
  17.                 if(sPtr == NULL)
  18.                 {
  19.                     sPtr = (SNODE*)malloc(sizeof(SNODE));
  20.  
  21.                     sPtr->data = &dPtr2->data;
  22.                     sPtr->price = price;
  23.                     dPtr1->link = sPtr;
  24.                     dPtr1->destinations++;
  25.                 }
  26.                 else
  27.                 {
  28.                     sPtr->link = (SNODE*)malloc(sizeof(SNODE));
  29.                     sPtr = sPtr->link;
  30.                     sPtr->data = &dPtr2->data;
  31.                     sPtr->price = price;
  32.                     dPtr1->destinations++;
  33.                 }
  34.             }
  35.             dPtr2 = dPtr2->forw;
  36.             j++;
  37.         }
  38.         printf("destinations: %d\n", dPtr1->destinations);
  39.  
  40.         dPtr1 = dPtr1->forw;
  41.         i++;
  42.     }
Add Comment
Please, Sign In to add comment