What are dynamic array operators in Pascal expressions?

Pascal dynamic arrays – like arrays in other programming languages – have several array manipulation methods. However, there is only one dynamic array operator that concatenates two arrays together: the + operator.

This operator is available in Delphi mode and must be enabled by the user.

It is also vital for array elements to be of similar data type, otherwise the program causes a compiler error.

Code

Let’s look at the code to see how dynamic arrays are concatenated in Pascal. We declare 3 arrays, and perform concatenation operations between them using the + operator.

program Hello;
// enable the dynamic array mode
{$mode objfpc}  
{$modeswitch arrayoperators}  
// declare arrays
var  
  a,b, arr : array of byte;  
 
begin  
  a:=[23, 45, 56];  
  b:=[13, 34, 45]; 
// use operator + 
  arr:=a + b;  
  writeln('Concatenated array =  ', arr);

Output:

Concatenated array =  [23, 45, 56, 13, 34, 45]
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved