title: Displaying ASCII Value for RAND Char
body: <p>I am displaying <strong>Random</strong> and <strong>Unique</strong> Characters in an array which I have done using the code provided at the end.</p>
  
  <ul>
  <li>I am generating 26 random letters with ASCII values from 65 to 90 and storing in an array.</li>
  <li>I am then generating a random letter and cross checking with each element already present in the array to check for uniqueness. </li>
  </ul>
  
  <p>I know this is very inefficient, however this is not an issue in my case.</p>
  
  <p><em>My problem is: <strong>How to display the ASCII value for each random character?</em></strong>
  I am used to displaying the ASCII value by using:</p>
  
  <p><code>printf("ASCII value of %c = %d\n", c, c);</code></p>
  
  <p>However since my letters are stored in <code>array[y]</code> I have been unable to do so successfully. </p>
  
  <p>My code is:</p>
  
  <pre><code>{
      int array[26];
      int x, y;
      int count;
      int i = 0;
      char c;
      srand(time(NULL));
  
      for (count = 0; count &lt; 26; count++)
      {
          array[count] = rand() % 26 + 65;
      }
  
      while (i &lt; 26) {
          c = rand() % 26 + 65;
  
          for (x = 0; x &lt; i; x++)
          {
              if (array[x] == c) {
                  break;
              }
          }
          if (x == i) {
              array[i++] = c;
          }
      }
      for (y = 0; y &lt; 26; y++) {
          printf(" %c = %d\n", array[y], c);
      }
  
      scanf_s("%d");
      return 0;  
  }
  </code></pre>
  
  <ol>
  <li><a href="https://i.stack.imgur.com/5dD2D.png" rel="nofollow noreferrer">Output</a> linked </li>
  <li>Randomness/Uniqueness working</li>
  <li>ASCII value only of last letter to be generated  </li>
  </ol>