title: How to create a correct array, that can be referenced via char** to pass parameters to LSF-API
body: <p>I want to use a small C wrapper to access a so called LSF-API. LSF is the "load sharing facility" which is something like a platform to dispatch computing jobs on various machines (created by IBM).</p>
  
  <p>I figured out how to do basic job submitting through populating a data structure and passing it to LSF. But when I tried to specify this data structure with some more of the defined attributes, I came to a problem which is connected to basic C issues.</p>
  
  <p>I want to specify a list of hostnames, where the job should be dispatched to.
  According to the API, this is done with those two fields:</p>
  
  <pre><code>char **     askedHosts -&gt; The array of names of invoker specified candidate hosts. The number of hosts is given by numAskedHosts.
  int     numAskedHosts  -&gt; length of the previous array
  </code></pre>
  
  <p>This <code>char **</code> makes my head aching:<br>
  I assumed, that I need to create an array with my hostnames as strings, specify the amount of them and pass this somehow to my data structure:</p>
  
  <pre><code>char *myHostArray[] = {"hostname_1","hostname_2","hostname_3"};
  int numberOfMyHosts = 3;
  myDatastructure.askedHosts = myHostArray;
  myDatastructure.numAskedHosts  = 3;
  </code></pre>
  
  <p>But whatever I try, it doesn't work. The depicted variant is the only one, where the compilation is at least successful and I do not get an "Segmentation fault" at runtime. 
  But in the end the information seems not to be passed correctly since it has no effects on the job dispatching.</p>
  
  <p>I guess I am messing up something with the pointers.
  Do you have any idea how I can pass this array correctly? I tried lots of variations but I was not successful after hours.</p>
  
  <p>Do you know what I could be doing wrong here?</p>
  
  <p>By the way - the API reference can be found here (I am talking about the "submit"-data structure):<br>
  <a href="https://www.ibm.com/support/knowledgecenter/en/SSWRJV_10.1.0/api_reference/index.html" rel="nofollow noreferrer">https://www.ibm.com/support/knowledgecenter/en/SSWRJV_10.1.0/api_reference/index.html</a></p>