title: is there is a way to make a variable take only certain values?
body: <p>Is there any way to define a variable for example that only accepts one values from 1 to 100?</p>
  <p>If the user try to assign a value that is out of this interval the program signs an error.</p>
  <p>I'm not looking for an algorithm of input control, like this:</p>
  <pre><code>#include &lt;stdio.h&gt; 
  
  int main ( ) {
      int n ;
      printf(&quot;give an interger number between 1 and 100 : &quot;);
      scanf(&quot;%d&quot;,&amp;n);
  
      while ( n &lt; 1 || n &gt; 100 )
      {
          printf(&quot;given value is wrong\ngive a new value between 1 and 100 : &quot;);
          scanf(&quot;%d&quot;,&amp;n);
      }
      return 0 ;
  }
  </code></pre>