> For the complete documentation index, see [llms.txt](https://cs.arkb.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cs.arkb.me/programming.md).

# Programming

## Data Types

In programs, data needs to be stored appropriately so that it can easily be accessed and manipulated. Data types are like **categories** that tell the computer which type of data you are using. This is important as it will allow the computer to know what kind of operations can be done on the data.

Sometimes, a single piece of data may be representable by multiple data types. If that happens, the programmer must choose a data type which is **best suited** for the problem or the most **memory-efficient**.&#x20;

Few Data Types:

* **Integer:** Whole number (positive, negative, or zero).
* **Real/Float:** Number with fractional parts.
* **Boolean:** True or false value.
* **Character:** A single letter, number, or symbol.
* **String:** A collection of characters.
* **Date/Time:** Stores a point in time, in various formats.
* **Pointer/Reference:** Stores memory addresses.
* **Records:** Collection of fields with different data types.
* **Arrays:** Indexed collection of elements, all of the same type.

Generally, there are two categories of data types: primitive and composite.

Primitive data types are basic building blocks of data in a programming language. They are single units of data within a language. E.g. Integers, Booleans and Floats.

&#x20;Composite data types are made up of multiple primitive data types, they simply connect multiple pieces of data together. E.g. Arrays and Records.

### User-defined data types

**User-defined data types** are custom data types which programmers can create to help them meet their specific needs. Unlike built-in data types (like integers or strings), you define the structure and components of these types.

Here are a few common examples:

1. **Structures (Structs)**: You can bundle different types of data together into one type. For example, you could create a "Person" data type that includes:
   * Name (String)
   * Age (Integer)
   * Gender (Character)
2. **Classes (in Object-Oriented Programming)**: A blueprint for creating objects. A class can have attributes (like a struct) and behaviours (functions or methods) associated with it. For example, a "Car" class might have:
   * Attributes: colour, model, speed
   * Methods: accelerate, brake
3. **Enums (Enumerations)**: A type that defines a set of named values. For instance, you could define an "enum" for the days of the week, where "Monday", "Tuesday", etc., are the values.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cs.arkb.me/programming.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
