Thanks for your replies. By the way, i not really understand why u say you are not free all the memory. You did it very well. My problem is the allcoation successfull at allocate function but when come back to main the rowptr and rowptr_1 become NULL. I don't know why. The swap done it well but i don't. Thanks for your replies.