//TeamSize is an integer
int Seg_id = shmget(SHM_KEY,sizeof(Word)*TeamSize,IPC_CREAT);
void* Seg_ptr = shmat(Seg_id,0,0);
new(Seg_ptr) Word[TeamSize];
I am having trouble with this segment of code. The Word class is a class that I defined with 8 bytes char array and some parse functions. I think I am using shmget and shmat just like how others use them. But I keep getting seg fault. When I print out Seg_id, it looks normal just some number. But Seg_ptr points at 0xffffffffffffffff. Then the next line of code obviously gives me seg fault. I want to know why Seg_ptr points at the end of memory space. Thanks in advance!