0666 is the usual access permision in linux in rwx octal format and having the sequence(owner-group-user). IPC_CREAT has the value of 512 in decimal as defined in the sys/ipc.h header file.
IPC_CREAT|0666 basically performs bitwise or of the two to set the flag in `shmget`, and both of them simply perform their usual functions.
0666 sets the access permissions of the memory segment while
IPC_CREAT tells the system to create a new memory segment for the shared memory.
If this flag is not used then `shmget()` will find the segment associated with key and check to see if the user has permission to access the segment.