๐ˆ๐Ÿ ๐ฒ๐จ๐ฎ ๐ก๐š๐ฏ๐ž ๐ค๐ง๐จ๐ฐ๐ฅ๐ž๐๐ ๐ž, ๐ฅ๐ž๐ญ ๐จ๐ญ๐ก๐ž๐ซ๐ฌ ๐ฅ๐ข๐ ๐ก๐ญ ๐ญ๐ก๐ž๐ข๐ซ ๐œ๐š๐ง๐๐ฅ๐ž๐ฌ ๐ข๐ง ๐ข๐ญ. | Shalu Anand

Post

editor-img
Shalu Anand
Oct 13, 2022

๐ˆ๐Ÿ ๐ฒ๐จ๐ฎ ๐ก๐š๐ฏ๐ž ๐ค๐ง๐จ๐ฐ๐ฅ๐ž๐๐ ๐ž, ๐ฅ๐ž๐ญ ๐จ๐ญ๐ก๐ž๐ซ๐ฌ ๐ฅ๐ข๐ ๐ก๐ญ ๐ญ๐ก๐ž๐ข๐ซ ๐œ๐š๐ง๐๐ฅ๐ž๐ฌ ๐ข๐ง ๐ข๐ญ.

with this,

๐—Ÿ๐—ฒ๐˜'๐˜€ ๐—•๐—ฒ๐—ด๐—ถ๐—ป ๐ฐ๐ข๐ญ๐ก ๐ƒ๐š๐ฒ 7 :

๐šœ๐šŽ๐š›๐š’๐šŽ๐šœ ๐š˜๐š ๐šœ๐š‘๐šŠ๐š›๐š’๐š—๐š ๐š–๐šข ๐š”๐š—๐š˜๐š ๐š•๐šŽ๐š๐š๐šŽ ๐š˜๐š ๐š๐š‘๐šŽ ๐™ฒ ๐™ป๐šŠ๐š—๐š๐šž๐šŠ๐š๐šŽ.

๐…๐ข๐ฑ๐ž๐ ๐–๐ข๐๐ญ๐ก ๐ˆ๐ง๐ญ๐ž๐ ๐ž๐ซ ๐“๐ฒ๐ฉ๐ž๐ฌ

The header <๐ฌ๐ญ๐๐ข๐ง๐ญ.๐ก> provides several fixed-width integer type definitions. These types are optional and only provided if the platform has an integer type of the corresponding width, and if the corresponding signed type has a two's complement representation of negative values.

๐’๐ž๐ž ๐ญ๐ก๐ž ๐›๐ž๐ฅ๐จ๐ฐ ๐ฌ๐ž๐œ๐ญ๐ข๐จ๐ง ๐Ÿ๐จ๐ซ ๐ฎ๐ฌ๐š๐ ๐ž ๐ก๐ข๐ง๐ญ๐ฌ ๐จ๐Ÿ ๐Ÿ๐ข๐ฑ๐ž๐ ๐ฐ๐ข๐๐ญ๐ก ๐ญ๐ฒ๐ฉ๐ž๐ฌ.

/* commonly used types include */

uint32_t u32 = 32; /* exactly 32-bits wide */

uint8_t u8 = 255; /* exactly 8-bits wide */

int64_t i64 = -65 /* exactly 64 bit in two's complement representation */

๐ˆ๐ง๐ญ๐ž๐ ๐ž๐ซ ๐ญ๐ฒ๐ฉ๐ž๐ฌ ๐š๐ง๐ ๐œ๐จ๐ง๐ฌ๐ญ๐š๐ง๐ญ๐ฌ

Signed integers can be of these types (the int after short, or long is optional):

signed char c = 127; /* required to be 1 byte, see remarks for further information. */

signed short int si = 32767; /* required to be at least 16 bits. */

signed int i = 32767; /* required to be at least 16 bits */

signed long int li = 2147483647; /* required to be at least 32 bits. */

signed long long int li = 2147483647; /* required to be at least 64 bits */

Each of these signed integer types has an unsigned version.

unsigned int i = 65535;

unsigned short = 2767;

unsigned char = 255;

For all types but char the signed version is assumed if the signed or unsigned part is omitted. The type char constitutes a third character type, difffferent from signed char and unsigned char and the signedness (or not) depends on the platform.

Decimal constants are always signed. Hexadecimal constants start with 0x or 0X and octal constants start just with a 0. The latter two are signed or unsigned depending on whether the value fifits into the signed type or not.