-2

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,587
  • 1
  • 11
  • 32
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
  • 622
  • 2
  • 9
  • 19