Unsigned Keyword


In C programming, the 'unsigned' keyword is used to declare variables that can hold only non-negative values.

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


unsigned int distance = 100;
printf("Distance: %u\n", distance);

    

In this example, the 'unsigned' keyword is used to declare an unsigned integer variable named 'distance' and initialize it with the value 100.

The 'unsigned' keyword is commonly used when you know that a variable will never hold negative values or when you need to utilize the entire range of positive values that a data type can represent.

Loading...

Search