title: C printing specific char depending on input from string with pointers
body: <p>Given this:</p>
  
  <pre><code> char c[]={ '0', 0, 'o', 'a', 'i', 'e' };
  
   char s_format[] = { "\nBra"
     "v%c!\n" };
  </code></pre>
  
  <p>The object of this program is to print different lines of code depending on the input, which can be:</p>
  
  <pre><code>                            OUTPUT
   ./nameofmyfile             Bravo
   ./nameofmyfile mp          Bravi
   ./nameofmyfile f           Brava
   ./nameofmyfile fp          Brave
  </code></pre>
  
  <p>In my main I have two char pointers:</p>
  
  <pre><code>char *q = c;      //this one is initialized at position c[0]
  char *p = NULL; 
  </code></pre>
  
  <p>I suppose I could use only the *q pointer in order to print either the character o, i, a or e in the s_format without using a switch construct.</p>
  
  <p>Would this for loop be perhaps correct?</p>
  
  <pre><code>for (unsigned int i=2; i&lt;sizeof(c); ++i) {
       printf("%c", *(q+i), s_format[4]);
  }
  </code></pre>
  
  <p>Or should I perhaps use a series of if's?</p>
  
  <pre><code>if ( argc &gt; 3 &amp;&amp; strlen(argv[3]) ) {
      if ( *(argv[3]) == 'f' )
          i = 3;
  }
  
  if ( argc &gt; 4 &amp;&amp; strlen(argv[4]) ) {
      if ( *(argv[4]) == 'mp' )
          i = 4;
  }
  
  if ( argc &gt; 1 &amp;&amp; strlen(argv[5]) ) {
      if ( *(argv[5]) == 'fp' )
          i = 5;
  }
  </code></pre>