0% found this document useful (0 votes)
3 views7 pages

Data Types and Their Range

The document provides an overview of common data types across various programming languages, including core types like integers, floats, booleans, and strings, along with specific types in languages such as Python, Java, JavaScript, C++, and more. It also details the ranges and sizes of integer and floating-point types, as well as null equivalents in different languages. Additionally, it highlights special data types in certain languages and includes a summary table for quick reference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Data Types and Their Range

The document provides an overview of common data types across various programming languages, including core types like integers, floats, booleans, and strings, along with specific types in languages such as Python, Java, JavaScript, C++, and more. It also details the ranges and sizes of integer and floating-point types, as well as null equivalents in different languages. Additionally, it highlights special data types in certain languages and includes a summary table for quick reference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Data Types and Their Range.

md 2025-07-08

Listing data types for all programming languages is not practical in one answer due to the large number of
languages and their unique types, but I’ll give you a comprehensive overview of the most common data
types, followed by examples of how they're used in popular languages (like C, Java, Python, JavaScript, C++,
and more).

🔢 Core Data Types (Common Across Most Languages)


Category Example Values Description

Integer 1, -23, 1000 Whole numbers

Float / Double 3.14, -0.99 Decimal numbers

Boolean true, false True/False values

Character 'a', 'Z', '9' Single character

String "hello", "123" Text (sequence of characters)

Array / List [1, 2, 3] Ordered collection of elements

Object {key: value} Key-value pair container (often custom types)

Null / None null, None Represents absence of a value

🧠 Common Data Types by Language

🔷 Python

int → 10
float → 3.14
bool → True / False
str → "hello"
list → [1, 2, 3]
tuple → (1, 2)
dict → {"name": "Snape"}
set → {1, 2, 3}
NoneType → None

🔷 Java

int → 10
float → 3.14f
double → 3.14159
boolean → true / false
char → 'a'

1/7
Data Types and Their Range.md 2025-07-08

String → "hello"
int[] → array
Object → class-based types
null → null

🔷 JavaScript

Number → 10 or 3.14
String → "hello"
Boolean → true / false
Object → {name: "Snape"}
Array → [1, 2, 3]
null → null
undefined → undefined
BigInt → 12345678901234567890n
Symbol → Symbol("id")

🔷C

int → 10
float → 3.14f
double → 3.14159
char → 'a'
_Complex → Complex number type
void → No return value (e.g., for functions)

🔷 C++

int → 10
float → 3.14
double → 3.14159
bool → true / false
char → 'a'
string → "hello" (std::string)
vector → dynamic array (std::vector<int>)
nullptr → null pointer

🔷 C#

2/7
Data Types and Their Range.md 2025-07-08

int → 10
float → 3.14f
double → 3.14159
bool → true / false
char → 'a'
string → "hello"
List<T> → Generic list
object → base class for all types
null → null

🔷 Go (Golang)

int → 10
float64 → 3.14
bool → true
string → "hello"
array → [3]int{1, 2, 3}
slice → []int{1, 2, 3}
map → map[string]int{"a": 1}
interface{} → any type (like `Object`)
nil → null equivalent

🔷 Rust

i32 → 10
f64 → 3.14
bool → true
char → 'a'
String → "hello".to_string()
&str → "hello"
Option → Some(value) / None
Vec → dynamic array

🔷 TypeScript (JavaScript with types)

number → 10, 3.14


string → "hello"
boolean → true / false
any → dynamic type
null → null
undefined → undefined
Array<number> → [1, 2, 3]
object → {name: "Snape"}
3/7
Data Types and Their Range.md 2025-07-08

📌 Special Data Types in Some Languages


Language Special Types Description

Python set, frozenset, complex Unique collections, immutable sets, etc.

Rust Option, Result Safe null/exception handling

Haskell Maybe, Either Functional programming constructs

Swift Optional, Tuple Optional values and groupings

Kotlin Nullable types (e.g., String?) Null safety built-in

SQL DATE, TIME, TEXT, BLOB Data storage types

🧮 Summary Table of Core Types Across Languages


Type Python Java JS C/C++ C# Go Rust

Integer int int Number int int int i32

Float float float Number float float float64 f64

Boolean bool boolean Boolean bool bool bool bool

String str String String char[]/string string string String

[] or
Array list [] Array [] List<> Vec
slice

Null None null null/undefined NULL null nil None

Would you like this as a PDF, cheat sheet, or more details for a specific language or framework (like React,
Django, etc.)?

Great! Here's an expanded guide with data types and their ranges for major programming languages like C,
C++, Java, Python, JavaScript, C#, and Go.

✅ Note: Ranges depend on the number of bits used to store the type (e.g., 8-bit, 32-bit). Some
languages (like Python) handle big numbers automatically, while others (like C) have fixed ranges.

🔹 1. Integer Types and Their Ranges


Language Data Type Size (bits) Signed Range Unsigned Range

0 to 4,294,967,295
C / C++ int 32 -2,147,483,648 to 2,147,483,647
(unsigned int)

short 16 -32,768 to 32,767 0 to 65,535

4/7
Data Types and Their Range.md 2025-07-08

Language Data Type Size (bits) Signed Range Unsigned Range

long 32 or 64 Depends on platform

−9,223,372,036,854,775,808 to
long long 64
9,223,372,036,854,775,807

Java byte 8 -128 to 127 —

short 16 -32,768 to 32,767 —

int 32 -2,147,483,648 to 2,147,483,647 —

−9,223,372,036,854,775,808 to
long 64
9,223,372,036,854,775,807

C# sbyte 8 -128 to 127 —

byte 8 0 to 255 —

short 16 -32,768 to 32,767 —

ushort 16 0 to 65,535 —

int 32 -2,147,483,648 to 2,147,483,647 —

uint 32 0 to 4,294,967,295 —

long 64 ±9.2 × 10¹⁸ —

ulong 64 0 to 18,446,744,073,709,551,615 —

Go int8 8 -128 to 127 —

uint8 8 0 to 255 —

int16 16 -32,768 to 32,767 —

int32 32 -2,147,483,648 to 2,147,483,647 —

int64 64 ±9.2 × 10¹⁸ —

i8, i16, i32,


Rust 8–128 Same as above —
i64, i128

Python int Unlimited* No fixed range — grows as needed —

💡 *Python integers are of arbitrary precision, so no overflow.

🔹 2. Floating Point Types and Ranges


Language Data Type Size Range Precision

C / C++ float 32-bit ±1.5 × 10⁻⁴⁵ to ±3.4 × 10³⁸ ~6-7 digits

double 64-bit ±5.0 × 10⁻³²⁴ to ±1.7 × 10³⁰⁸ ~15-16 digits

5/7
Data Types and Their Range.md 2025-07-08

Language Data Type Size Range Precision

long double ≥ 64-bit Compiler dependent Higher

Java float 32-bit ±1.4 × 10⁻⁴⁵ to ±3.4 × 10³⁸ ~6-7 digits

double 64-bit ±4.9 × 10⁻³²⁴ to ±1.8 × 10³⁰⁸ ~15-16 digits

C# float 32-bit ±1.5 × 10⁻⁴⁵ to ±3.4 × 10³⁸ ~7 digits

double 64-bit ±5.0 × 10⁻³²⁴ to ±1.7 × 10³⁰⁸ ~15 digits

decimal 128-bit ±1.0 × 10⁻²⁸ to ±7.9 × 10²⁸ 28-29 digits

Go float32 32-bit ±1.5 × 10⁻⁴⁵ to ±3.4 × 10³⁸ ~7 digits

float64 64-bit ±5.0 × 10⁻³²⁴ to ±1.7 × 10³⁰⁸ ~15 digits

Python float 64-bit Same as C double ~15 digits

JavaScript Number 64-bit ±5.0 × 10⁻³²⁴ to ±1.8 × 10³⁰⁸ ~15-17 digits

✅ JavaScript only has one number type (IEEE 754 double precision). For very large integers, use
BigInt.

🔹 3. Boolean and Character Types


Type Example Common in Languages

bool true/false All modern languages

char 'a', 'Z' C, C++, Java, C#, Rust

string "Hello" All high-level languages

Size of char:

C/C++: 1 byte (ASCII)


Java / C#: 2 bytes (UTF-16)
Python: Unicode strings (no char type)
Go: rune for Unicode characters (4 bytes)

🔹 4. Null / Undefined / None Types


Language Null Equivalent

Python None

Java null

JavaScript null, undefined

C/C++ NULL, nullptr

6/7
Data Types and Their Range.md 2025-07-08

Language Null Equivalent

C# null

Go nil

Swift nil

Rust None (via Option)

7/7

You might also like