Is it possible to send a reference to a variable as a parameter to an executable in C?
Suppose I have a parent process called main
which has multiple arrays defined. Now, if I fork()
and exec*()
a C program called sort
per array. My questions are: can I create a sort
program which can access by reference an array (defined in main
)? How can I pass the reference to an array from main
?
The advantage that I see in this implementation is the simplicity that I get as the parent process passes the reference to the array, and once the sort
has exited properly, the array will be sorted. (Given, I must write and use the program sort
.)