search

In computer programming, the term "unsigned" refers to a variable that can only hold positive numbers. "Signed" in computer code means that a variable can contain negative and positive values. This property applies to most numeric data types, including int, char, short, and long.

What is unsigned in computer programming

Unsigned variable integer type

The int of the unsigned variable type can contain zero and positive numbers, while the signed int can contain Negative numbers, zero and positive numbers.

In 32-bit integers, the range of unsigned integers is 0 to 232-1 = 0 to 4,294,967,295, which is approximately 4 billion. The signed version goes from -231-1 to 231, which is -2,147,483,648 to 2,147,483,647, or - 2 billion to 2 billion. The range is the same, but moved on the number line.

By default, the int type in C, c and c# is signed. If negative numbers are involved, the programmer must change to unsigned.

Unsigned characters

For characters with only 1 byte, the range of unsigned characters is 0 to 256, while the range of signed characters is -127 to 127 .

Independent type specifiers and other uses

Unsigned (and signed) can also be used as independent type specifiers, but if used individually, they default to int .

Objects of type long can be declared as signed long or unsigned long. Signed long is the same as long because signed is the default.

The above is the detailed content of What is unsigned in computer programming. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment