Advertisement
Guest User

Untitled

a guest
Jun 24th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. Booking **bookingSelectPaid(Booking **booking)
  2. {
  3.     Booking **ret = malloc(sizeof(Booking*));
  4.     size_t i = 0;
  5.     int numOfPaid = 0;
  6.     while (booking[i] != NULL)
  7.     {
  8.         if (booking[i]->paid == 1)
  9.         {
  10.             ++numOfPaid;
  11.             size_t newsize = sizeof(Booking*) * (numOfPaid + 1); ret = realloc(ret, newsize);
  12.             ret[i] = booking[i];
  13.             ret[i+1] = NULL;
  14.         }
  15.         ++i;
  16.     }
  17.     return ret;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement