title: Print a C pointers of a shared memory
body: <p>I'm new to C and I have a question about char pointers and shared memory and what it will print. Take a look:</p>
  <pre><code>key_t ke =ftok(&quot;./exe&quot;,&quot;k&quot;); 
  int ds_shm=shmget(ke,100,IPC_CREAT|IP_ECXL|0644);
  char *p;
  
  if ( ds_shm&lt;0) {   //if the memory alredy exists
  
      ds_shm=shmget(ke,100,0644); //get the identifier
  
      p= (char*) shmat(ds_shm,NULL,0);  //p cointain  the address of the shm
  
  } else {  // if not texted create it
  
      p= (char*) shmat(ds_shm,NULL,0); // p now contain the address
   
      strncpy(p,&quot;hello&quot;,sizeof(&quot;hello&quot;));  //init
  
  }    
  </code></pre>
  <p>Now, if I want to see the content my professor does:</p>
  <pre><code>printf(&quot; Content of shared memory: %s\n&quot; , p); 
  </code></pre>
  <p>but shouldn't it be using a <code>*</code> to access the value of the variable?</p>
  <pre><code>printf(&quot; Content of shared memory: %s\n&quot; , *p); // ??
  </code></pre>