shmget()

This allocates a shared memory segment and returns the shared memory identifier that's associated with the key. Here is its syntax:

int shmget(key_t key, size_t size, int shmflg);

Here, we need to address the following:

On successful execution, the function returns the shared memory identifier in the form of a non-negative integer, otherwise it returns -1.