Why function is not returning negative value in C? : <p>I am writing this code to return a value which I will pass through the parameter of the function and print that value.
here is my code: </p>

<pre><code>#include&lt;stdio.h&gt;
int abs(int x)
{
    if(x&lt;0)
       return x;
}
int main()
{
    int x = -6;
    printf("Value of abs is %d\n",abs(x));
   return 0;
}
</code></pre>

<p>This code giving me the output:</p>

<blockquote>
  <p>Value of abs is 6</p>
</blockquote>

<p><em>Why this code is not returning -6  ?</em> </p>

<p>how to solve this ? </p>

<p>thanks in advance :)</p>
