title: Filling char array with snprintf()
body: <p>I am trying to fill a char array with values under conditions. The problem is I can not use <code>snprintf()</code> not properly. </p>
  
  <pre><code>    char staedte[MAX_LAENGE_ARR][MAX_LAENGE_STR];
      char laender[MAX_LAENGE_ARR][MAX_LAENGE_STR];
      int bewohner[MAX_LAENGE_ARR];
  
  
      char *p = (char*) malloc(len);
      if (p == NULL){
          perror("malloc failed while allocating an array of chars.");
          exit(1);
      }
  
      for (int i = 0; i &lt; MAX_LAENGE_ARR; i++) {
          if(strcmp(bundesland,laender[i]) == 0 &amp;&amp; bewohner[i] &gt;= anzahl){
              snprintf(p,MAX_LAENGE_STR,"Die Stadt %s hat %d Einwohner. \n", staedte[i],bewohner[i]);
              snprintf(&amp;p[i],MAX_LAENGE_STR,"Die Stadt %s hat %d Einwohner. \n", staedte[i],bewohner[i]);
          }
      }
      free(p);      
  }
  </code></pre>