Skip to content
The Computer Science
TheCScience
  • Engineering Subjects
    • Human Values
    • Computer System Architecture
    • Digital Communication
    • Internet of Things
  • NCERT Solutions
    • Class 12
    • Class 11
  • HackerRank solutions
    • HackerRank Algorithms Problems Solutions
    • HackerRank C solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
The Computer Science
TheCScience

Basic Computer Data Types

YASH PAL, March 9, 2026March 9, 2026

Basic Computer Data Types – Computers operate fundamentally on fixed-size numbers called words, which are interpreted as integers, characters, floating-point numbers, bit sets, or memory addresses, then combined into larger aggregates.

There are basically four Data types:

  • Basic types: numbers, strings, and booleans.
  • Aggregate types: arrays and structures.
  • Reference types: pointers, slices, maps, functions, and channels.
  • Interface types

Integers

In this, we provide both signed and unsigned integers for arithmetic operations. There are four distinct sizes of signed integers: 8, 16, 32, and 64 bits. They are represented by:

  • Signed: int8, int16, int32 and int64.
  • Unsigned: uint8, uint16, uint32, and uint64.

There are also two types, int and uint, that are the natural or most efficient size for signed and unsigned integers on a particular platform. int is by far the most widely used numeric type. Both these types have the same size, either 32 or 64 bits. But one must not make assumptions about because different compilers may make different choices even on identical hardware.

The type run is a synonym for int32 and conventionally indicates that a value is a Unicode point. The two names may be used interchangeably. The type byte is a synonym for uint8, and emphasizes that the value is a piece of raw data rather than a small numeric quantity.

uintptr is an unsigned integer type whose width is not specified but is sufficient to hold all the bits of a pointer value. The uintptr type is used only for low-level programming, such as at the boundary of a Go program with a C library or an operating system.

Floating-point Numbers

There are two sizes of floating-point numbers, whose properties are governed by the IEEE 754 standard (implemented by all modern CPUs). The limits of floating-point values can be found in the math package.

float32

  • The largest float 32 is the constant math.MaxFloat32, which is about 3.4e38.
  • The smallest positive value is 1.4e-45.

float64

  • The largest float64 is the constant math.MaxFloat64, which is about 1.8e308.
  • The smallest positive value is 4.9e-324.

Complex Numbers

This provides two sizes of complex numbers, complex64 and complex128, whose components are float32 and float64, respectively. The built-in function complex creates a complex number from its real and imaginary components, and the built-in real and imag functions extract those components:

var x complex128 = complex(1,2) // 1+2i
var y complex128 = complex(3,4) // 3+4i
fmt.Println(x*y)  // "(-5+10i)"
fmt.Println(real(x*y))  // "-5"
fmt.Println(imag(x*y)) // "10"

If a floating-point literal or decimal integer literal is immediately followed by i, such as 3.141592i or 2i, it becomes an imaginary literal, denoting a complex number with a zero real component;

Booleans

A value of type bool, or boolean, has only two possible values, true and false.

  • The conditions in if and for statements are booleans
  • Comparison operators (e.g., ==,<>) produce a boolean result.
  • The unary operator ! is logical negation. For example, !true is false, or, (!true == false) == true.
  • Redundant boolean expressions can be simplified, like x == true to x.

Boolean values can be combined with the && (AND) and || (OR) operators, which have short-circuit behaviour: if the answer is already determined by the value of the left operand, the right operand is not evaluated, making it safe to write expressions like this-

s != "" && s[0] == 'x'

where s[0] would panic if applied to an empty string.

Since && has higher precedence than || (mnemonic: && is boolean multiplication, || is boolean addition), no parentheses are required for conditions of this form.

Strings

A string is an immutable sequence of bytes. Strings may contain arbitrary data, including bytes with value 0, but usually they contain human-readable text. Text strings are conventionally interpreted as UTF-8-encoded sequences of Unicode code points. The built-in len function returns the number of bytes (not runes) in a string, and the index operation s[i] retrieves the i-th byte of string s, where 0 = i < len(s).

s:= "hello, world"
fmt.Println(len(s)) // "12"
fmt.Println(s[0], s[7]) // "104 119" ('h' and 'w')

In the above code, s[0] and s[7] are of the uint8 type.

Range of data types

Dat TypeBytesData RangeRemarks
char1ASCII – 128 to 127
unsigned char1ASCII 0 to 255including high ASCII chars
int2-32768 to 32767Integer
unsigned (unsigned int)20 to 65535non-negative integer
long int4± 2 billionsdouble-sized integer
unsigned long int40 to 4 billionnon-negative long integer
float43.4±e386 significant digits
double81.7±e30815 significant digits
Range of data types

There are basically four types of number systems:

  1. Binary Number System: A binary number system has only two digits, which are 0 and 1. Every number (value) represents with 0 and 1 in this number system. The base of the binary number system is 2, because it has only two digits.
  2. Decimal Number System: The decimal number system has only ten (10) digits from 0 to 9. Every number (value) represents with 0,1,2,3,4,5,6,7,8 and 9 in this number system. The base of the decimal number system is 10, because it has only 10 digits.
  3. Octal number system: The octal number system has only eight (8) digits from 0 to 7. Every number (value) represents with 0,1,2,3,4,5,6 and 7 in this number system. The base of the octal number system is 8, because it has only 8 digits.
  4. Hexadecimal number system: A Hexadecimal number system has sixteen (16) alphanumeric values from 0 to 9 and A to F. Every number (value) represents with 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E and F in this number system. The base of the hexadecimal system is 16, because it has 16 alphanumeric values. Here, A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15.
Number systemBaseUsed digitsExample
Binary20,1(11110000)2
Octal80,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F(360)8
Decimal100,1,2,3,4,5,6,7,8,9(240)10
Hexadecimal160,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F(F0)16
Number System
Computer System Architecture engineering subjects Computer System Architecture

Post navigation

Previous post

Basic structure of a computer
Functional Units of a Computer
Development of Computers
Von Neumann and Harvard Machine Architecture
Flynn Classification
Computer Structure Architecture
Basic Computer Data Types
Arithmetic Complement
Real Numbers Representation
Interfacing Logic Devices
Levels of Design Abstraction
Performance Metrics

Register Transfer Language
Memory Transfer
Arithmetic Micro-operations
Arithmetic Complements
Logic Micro-operations
Shift Micro-operations
Bus Architecture
Data Transfer
Bus and Memory Transfer
Central Processing Unit
CPU Bus Architecture

Difference between Computer Architecture and Organization
Computer Register and Types
Common Bus System
Instruction Format
Instruction Types
Instruction Cycle
Fetch Decode Execute Instruction Cycle
Timing and Control of Instruction Cycle
Input-Output and Interrupt
Memory Reference Instructions
Addressing Modes
Design of a basic computer
Design of Accumulator Unit
Design of Control Unit
Difference between Hardwired Control and Microprogrammed Control

Basic Function of a Computer
Register organization
General Register Organization
Stack organization
Infix to Reverse Polish Notation Conversion
Instruction Types and their classifications
Data transfer and manipulation
Program control
RISC and CISC
Difference between RISC and CISC

Parallel Processing
Pipeline
Types of Pipeline
Arithmetic Pipeline
Instruction Pipeline
Hazards
RISC Pipeline
Vector Processing
Array Processors

Machine Language
Assembly Language
Arithmetic and Logical Operations
Subroutine
Data Representation
Addition and Subtraction
Adder Circuits
Shift and Add Multiplication Method
Booth's Algorithm
Restoring Division Algorithm
Non-Restoring Division Algorithm
Array Multiplier
Hardwired control and Microprogrammed control Difference

Memory Classification
Memory Characteristics
Memory Organization
Memory Types
Auxiliary Memory
Associative Memory
Cache Memory
Virtual Memory
Paging and Segmentation Difference
Multiprocessor
Interconnection Structures
Interprocessor Arbitration
Interprocessor Communication and Synchronization
Cache Coherence
Shared Memory Multiprocessors

Input Output Interface
Asynchronous Data Transfer
Modes of Data Transfer
Input-Output Programming
Priority Interrupt
Microprogramming
Control Memory
Address Sequencing
Micro Program Examples
Direct Memory Access
Input-Output Processor
Serial Communication

TheCScience

We at TheCScience.com are working towards the goal to give free education to every person by publishing in dept article about Secondary, Senior-Secondary, and Graduation level subjects.

Pages

About US

Contact US

Privacy Policy

DMCA

Our Tools

Hosting - get 20% off

Engineering Subjects

Internet of Things

Human Values

Digital Communication

Computer System Architecture

Programming Tutorials

Data Structure and Algorithm

C

Java

NCERT

Class 12th

©2026 TheCScience | WordPress Theme by SuperbThemes