Assigning strings in shared memory processes
问题 I have a program that needs to share a string between two processes. I have declared a struct that contains an array of *char . This struct is allocated with shmget and shmat before the main process is forked. typedef struct Queue { int index; char *directory[10]; } Queue; In one of the processes, I try to set the value: ( data->dir_name is a *char to a string such as "/data1") queue->directory[i] = data->dir_name; // Option 1 queue->directory[i] = "foo"; // Option 2 My question is, what is