Most elegant way to share a C array

后端 未结 4 467
暗喜
暗喜 2021-01-18 22:01

I have to turn back to (embedded) C after some lengthy time with C++, and have the following problem:

I have a source module which is included a lot of times, let\'s

4条回答
  •  别那么骄傲
    2021-01-18 22:29

    Create a new function at utilities.c called something like "get_important_array" that just returns a pointer to array and put the prototype at utilities.h. After that, when you put the utilities.h at worker.c you'll have important_array access in a simple, and organized way.

提交回复
热议问题