Given this struct:
struct PipeShm { int init; int flag; sem_t *mutex; char * ptr1; char * ptr2; int status1; int status2; int semaphoreFlag; }; That works fine:
static struct PipeShm myPipe = { .init = 0 , .flag = FALSE , .mutex = NULL , .ptr1 = NULL , .ptr2 = NULL , .status1 = -10 , .status2 = -10 , .semaphoreFlag = FALSE }; But when I declare static struct PipeShm * myPipe , that doesn't work , I'm assuming that I'd need to initialize with the operator ->, but how?
static struct PipeShm * myPipe = {.init = 0 , .flag = FALSE , .mutex = NULL , .ptr1 = NULL , .ptr2 = NULL , .status1 = -10 , .status2 = -10 , .semaphoreFlag = FALSE }; Is it possible to declare a pointer to a struct and use initialization with it?