C - fork() and sharing memory

后端 未结 3 784
甜味超标
甜味超标 2021-02-19 15:30

I need my parent and child process to both be able to read and write the same variable (of type int) so it is \"global\" between the two processes.

I\'m assuming this wo

3条回答
  •  一整个雨季
    2021-02-19 16:31

    If you need to share memory, perhaps using threads instead of processes would be a better solution?

提交回复
热议问题