Home > Article > Backend Development > What does sign mean in c language?
In C language, the sign() function returns the sign of the expression (positive, negative, or zero). Return value: 1 if the expression is positive, -1 if it is negative, and 0 if it is zero.
sign means in C language
In C language, sign function Returns the sign of the expression, which can be positive, negative, or zero.
Usage
<code class="c">int sign(int n);</code>
Where:
Return value
Example
<code class="c">int num1 = 5, num2 = -10; printf("sign(%d) = %d\n", num1, sign(num1)); printf("sign(%d) = %d\n", num2, sign(num2));</code>
Output:
<code>sign(5) = 1 sign(-10) = -1</code>
The above is the detailed content of What does sign mean in c language?. For more information, please follow other related articles on the PHP Chinese website!