terminal

codeando_simple

terminal

menu

terminal

search_module

guest@codeandosimple: ~/system/search $ grep -r "" .

Press [ENTER] to execute search

Status

Engine: Ready

Database: Online

Index: V2.1.0_LATEST

bash -- cat logica-registros.md
guest@codeandosimple: ~/blog/logic $ cat records.md

Logic - Records_

// "You don't have to be great to start, but you have to start to be great" - Zig Ziglar

RECORDS (Records/Structs) are programmer-defined data types that allow encapsulating related information under a single unit. Discover how to improve the readability and structure of your algorithms with this fundamental tool.

Video thumbnail

# Introduction to Records

Records are structures that group elements of different types (unlike arrays). They allow handling related data under a single identity, facilitating abstraction and the path to Object-Oriented Programming.

Structure of a Record:

RECORD record_name
START
    data_type field1
    data_type field2
END

# Example: Salary Calculation

We define a EmployeeRec record with ID, name, and amount. This allows accessing all employee information through a single variable.

Employee record definition
Use of employee record

# Field Access

To access the fields, we use the dot operator .:

Dot access

# Array of Records

Each position in the array corresponds to a complete record.

Record array diagram
Record array code

# Practice Exercises

In the next article we will see recursion, an important topic for dealing with problems of a recursive nature.

Resources used