title: Array typedef Struct not functioning properly when called by function
body: <p>I declare</p>
  
  <pre><code>typedef struct LABELS_STRUCT {
  char *name;
  int address;
  } `LABELS_STRUCT;`
  
  LABELS_STRUCT labels_array[ARRAY_LABELS];
  </code></pre>
  
  <p>and a function that adds a name and address the the aray</p>
  
  <pre><code>int add_data_label(char * label, int displace) 
  {
      LABELS_STRUCT x = {label,DATA_STARTING_ADDRESS + (100 * displace)};
      labels_array[initialize]=x;
      initialize++;//=initialize+displace;
      printf("\tAdding [%s] with offset [%d] to labels_array[%d] with address [%d]\n", label,displace,initialize,CODE_STARTING_ADDRESS + (100 * displace));
      printf("\tlabels_array[%d].name=[%s] and labels_array[%d].address= [%d]\n", initialize, labels_array[initialize].name, initialize, labels_array[initialize].address);   
  
      return 1;
  }
  </code></pre>
  
  <p>The second <code>printf()</code> statement prints out the data correctly but when I have another function</p>
  
  <pre><code>int get_label_address(char *label) {
      int i;
      printf("Getting the Label Address for [%s]\n", label);
      for (i = 0; i &lt; initialize; i++) {
          printf("\t\t\tCOMPARING LABEL [%s] TO [%s] at index [%d]\n", label, labels_array[i].name,i);
          if (labels_array[i].name==label) {
              printf("Label_Array[%d]=[%s] Matches label=[%s] with address [%d]\n",i,labels_array[i].name,label,labels_array[i].address);
              return labels_array[i].address;
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>The debug <code>printf()</code> statement <code>"COMPARING LABEL [%s] to [s]..."</code> Loop shows that its being compared to <code>null</code>. When I use any other function to print the element in <code>labels_array[i].name</code>, it gives me a blank value for the name element but not for the address element. Lets say I have three elements that I put into the array, <code>labey_array[1 2 and 3]</code> will be a blank line but <code>label_array[4 and on]</code> will have <code>null</code>. So it knows it was initialized but its not showing the actual name, just a blank line. </p>
  
  <p>Anyone have any ideas?</p>