Signed Keyword


In C programming, the 'signed' keyword is used to declare variables that can hold both positive and negative values.

It is used to explicitly indicate that a variable is a signed integer.

Here's an example of using the 'signed' keyword to declare a variable:


signed int temperature = -10;

    

In this example, the 'signed' keyword is used to declare a variable named 'temperature' and initialize it with the value -10.

By default, 'int' variables are signed, so the use of 'signed' keyword is optional. However, explicitly using the 'signed' keyword can make the code more self-explanatory.

It's important to note that 'signed' is the default sign specifier for integer types in C, so even if you omit the 'signed' keyword, the variables will be considered signed.

However, using the 'signed' keyword can help improve code readability and make the programmer's intent clearer.

Loading...

Search