-1

How can I declare a variable or array that contain a value which does not get destroyed when the program terminates in c or c++?

2 Answers2

3

When the process terminates, the kernel releases the resources owned by it. If you want to keep data/information obtained during the runtime of the process, you can use a database or the file system.

Saucy Goat
  • 1,554
  • 1
  • 9
  • 29
0

if you want to keep data after your process terminates, try storing it in a file. check this for more: file handling in C++

Ismail El Moudni
  • 434
  • 1
  • 7
  • 15