title: C++ See If Argument Is Numeric
body: <p>I'm creating an encryption/decryption program in C++, and I use three user-provided numbers to customize the encryption. I read about isdigit() on cplusplus.com, and made a function based on that:</p>
  
  <pre><code>bool is_numeric(char *string)
  {
      int sizeOfString = sizeof(string);
      int iteration = 0;
      bool isNumeric = true;
  
      while(iteration &lt; sizeOfString)
      {
          if(!isdigit(string[iteration]))
          {
              isNumeric = false;
              break;
          }
  
          iteration++;
  
      }
  
      return isNumeric;
  }
  </code></pre>
  
  <p>However, it doesn't seem to work. Whether I give it a number, or a non-numeric character, it still returns false. What is wrong with my approach.</p>