title: Creating a 2D array of char in the shared memory c
body: <p>I want to create a 2D array of char and share it through shared memory, but when I try to write in my shared memory I have segmentation fault, what can I do to write a string in my array</p>
  
  <pre><code> int main {
              int j;
          char** shm = malloc(30 * sizeof(char *));
  
            for (int index=0;index&lt;30;++index)
            {
              shm[index] =malloc(100 * sizeof(char));
            }
  
            int sh_id;
            int i;
            size_t sizeMatrix = sizeof_dm(30,100,sizeof(char));
  
            //creation ou ouverture de la file de segment partag�e
            key_t keyfile = ftok("keyFileIpc.txt",10);
  
            if((sh_id = shmget(keyfile,sizeMatrix,IPC_CREAT|0666)) == -1) {
              perror("shmget");
              exit(1);
            }
  
            //on attache le segment au shm
            if ((void*)(shm =(char**)shmat(sh_id, NULL, 0)) == (void *) -1) {
              perror("shmat");
              exit(1);
            }
            //i can't write in here and i don't know why
            for (j=0;j&lt;30;j++)
            {
              strcpy(shm[j],"i'm here");
            }
            printf("here\n");
      return 0;
  
  }
  </code></pre>