papori 0 Newbie Poster

hey, i create a segment , then i attach it to data space, now i want to put the array in this space
what sould i do next? how to assign it into?

  int shmid , size=5;
  int *shm;
  int array[] = {1,2,3,4,5};
//   Create the segment.
    if ((shmid = shmget(IPC_PRIVATE, size,  0600)) < 0) {
        perror("shmget");
        exit(1);
    }
//  Now we attach the segment to our data space.
    if ((shm = shmat(shmid, NULL, 0)) == (int *) -1) {
        perror("shmat");
        exit(1);
    }