i'm currently working a on program that uses linked lists to store information. it runs on the command line and does it's thing and when it's done, it calls a function to delete the entire linked list. now, as far as i know, if the user hits CTRL-C or simply closes the console, the program does not free the allocated memory.
i've looked into signals, but am a little confused about where to begin. the material i've read so far does not allow me to use a function and pass arguments to it.
has anybody encountered a similar problem and have a solution?
i noticed this thread: How to prevent exiting from running program
however, i do not want to disable it, as i would like for them to have the option of exiting anytime they like.
thanks for any help, if you need code posted, i'll put it up