For fun I was making some kind of console 'paint',you could normaly save map and load it, however when my friends tested, they used the "x" to close it, resulting in loss of last picture(i had an inside "exit" function). so i've googled and found the atexit();, but it takes functions without parametres, so i'd have to make a global var to save, that's the easy way, however just for curiosity i've thought of storing the address of the map in an external file. the function at exit should read the address then cast it to a struct pointer(map variable) to save...
so the question is: what type should be the variable with the address and is this the proper way to cast it to struct?
I already have a function to save it properly and in a readable format, I'd just need to read the address from a file created, I only need to properly read addres and assign it to the pointer...
a. The code is not guaranteed to work on all implementations - for instance, on one that uses segmented addressing.
b. Any programming error could be a disastrous 'silent' error - the best you can hope for is that an error would cause the program to crash immediately.