why c accept a string in a int variable : <p>This is my first question here, sorry if I did something wrong.
I have to make a program that identify the classification of a swimmer. The program does this, but when i write a string, it accept like a int variable.
why this happens and how I fix this.
thanks </p>

<pre><code>printf("Write the age of the swimmer\n");
scanf("%d", &amp;age);
if(age &lt; 5)
    printf("minimum age is five years old\n");
else if(age &gt;= 5 &amp;&amp; age &lt;= 7)
    printf("Category: child A\n");
else if(age &gt;= 8 &amp;&amp; age &lt;= 11)
    printf("Category: child B\n");
else if(age &gt;= 12 &amp;&amp; age &lt;= 13)
    printf("Category: Juvenile A\n");
else if(age &gt;= 14 &amp;&amp; age &lt;= 17)
    printf("Category: Juvenile A\n");
else if(age &gt;= 18)
    printf("Category: Adult\n");
else 
    printf("Write only numbers\n");




system("PAUSE");
return 0;
</code></pre>
