Link to home
Start Free TrialLog in
Avatar of sinha_anshul26
sinha_anshul26

asked on

Linking Linked List To Hard Disk

A simple linked list--

struct node{
int data;
node *next;
}


Generally when we create LL it gets created in RAM , what if I want to store it hard disk so that I can add / delete more nodes to it.



SOLUTION
Avatar of sin_
sin_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sinha_anshul26
sinha_anshul26

ASKER

Hi Sin_
Just to confirm I got it right...
you  mean to say,(In other words) that there is no way that we can store data at a specific location of the Hard disk (using pointers)?

I read somewhere that OS does this to manage files using FAT file system
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's right Anshu! Compiler generates the virtual memory addresses, which  are mapped to a physical page address by MMU while running the application. Therefore, everytime you run the application, you will find that your pointer is pointing to a different address.

Just imagine if you store this address; it may be a garbage next time. Persistence mechanism works by storing the content; you can reconstruct the data structure while reading it back.

Hope it helps.

>>Hope it helps
It Helped alot ...thank you both of you
Oh !! I choose the other way round sin_ 's  answer should be  Accepted and manish's assisted.
But any way thank you both for  helping


Not a problem! I too didn't know anything about FAT ptrs :)