title: Why does my function only return the number 8?
body: <p>I have this block of C code that is used to determine the arabic number of given roman numerals. The problem is, this code only gives out the number 8.</p>
  <pre><code>char * romanNumerals[13] = {&quot;I&quot;, &quot;IV&quot;, &quot;V&quot;, &quot;IX&quot;, &quot;X&quot;, &quot;XL&quot;, &quot;L&quot;, &quot;XC&quot;, &quot;C&quot;, &quot;CD&quot;, &quot;D&quot;, &quot;CM&quot;, &quot;M&quot;};
  int arabicNumbers[13] = {1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000};
  
  char * prob2(char * roman) {
      int arabic = 0;
      int romanSize = (sizeof(roman)/sizeof(roman[0]));
  
      for (int i = 0; i &lt; romanSize; i++) {
          int f_arabic = arabicNumbers[findArrayPos(romanNumerals, roman[i])];
          if (i+1 == romanSize) {
              arabic += f_arabic;
              break;
          }
  
          int s_arabic = arabicNumbers[findArrayPos(romanNumerals, roman[i+1])];
          if (f_arabic &gt;= s_arabic) {
              arabic += (f_arabic);
          }
          else {
              arabic += (s_arabic-f_arabic);
          }
      }
  
      char * answer = (char*)malloc(sizeof(arabic)+1);
      sprintf(answer, &quot;%i\n&quot;, arabic);
      return answer;
  }
  
  int findArrayPos(char ** arr, char find) {
      int foundAt = 0;
      for (int i=0;i&lt;sizeof(arr);i++) {
          if (arr[i] == &amp;find) {
              foundAt = i;
          }
      }
      return foundAt;
  }
  </code></pre>
  <p>Any help would be appreciated :)</p>