Dynamic matrix

I have written below code for dynamic matrix, and it has got an error compiling
C:\Users\kostas\AppData\Local\Temp\build6344196874205377199.tmp/dynamic_matrix.cpp:83: undefined reference to operator new[](unsigned int)' C:\Users\kostas\AppData\Local\Temp\build6344196874205377199.tmp/dynamic_matrix.cpp:86: undefined reference to operator new[](unsigned int)'

and I don’t understand, that is the wrong?

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 6, 7);

int **matrix;
int m;  //col
int n;  //row

/////////////////////////DILOSI METAVLITON GIA TO PLIKTROLOGIO
int analogInputPin=0;
int totalOutputDigit=9;
int KeyForEnder='D';
int keyForClear='C';
int rowToPrint=0;
int columnToPrint=0;
int keyboardMode='mod0';
int IncomingString;
///////////////////////////DILOSI METAVLITON GIA TO PLIKTROLOGIO



void printmatrix(int **matrix, int m, int n);
void readmatrix(int **matrix, int m,int n);


void setup()
{
  Serial.begin(1200);
  lcd.begin(6,2);


}
void loop()
{
  rowToPrint=15;
  columnToPrint=1;
  lcd.print("row");
   n=getPressString(IncomingString,analogInputPin,KeyForEnder,keyForClear,rowToPrint,columnToPrint,keyboardMode);
  Serial.print("number row:");
  Serial.print(n);
  lcd.clear();
  lcd.print("collumn");
   m=getPressString(IncomingString,analogInputPin,KeyForEnder,keyForClear,rowToPrint,columnToPrint,keyboardMode);
  Serial.print("number col:");
  Serial.print(m);
  lcd.clear();
  
  matrix= new int*[n];
  for(int i=0; i<n; i++)
  {
    matrix[i]=new int[m];
  }
  
  readmatrix(matrix, m, n);
  printmatrix(matrix, m, n);

halt:
  goto halt;
}


void readmatrix(int **matrix, int m,int n)
{
  int i,j;
  int rowToPrint=15;
  int columnToPrint=1;
  for(i=0; i<=n; i++)
  {
    for(j=0; j<=m; j++)
    {
      lcd.print("stoixeio ");
      lcd.print(i);
      lcd.print(j);
      matrix[i][j]=random(200);
      Serial.print(matrix[i][j]);
    }  
  }  
}


void printmatrix(int **matrix, int m, int n)
{
  int i,j;

  for(i=0; i<=n; i++)
  {
    for(j=0; j<=m; j++)
    {
      Serial.print(matrix[i][j]);
    }
    Serial.println(" ");
  }
}


The function getPressString read the keyboard (4 row, 4 column, 16 button)

There is no "new" operator in Arduino.

halt:
goto halt;

Run for the hills!

How to make a dynamic matrix in the arduino IDE?

malloc?

Can you give me an example please?

int* vector = (int*)malloc(sizeof (int) * vect_size);

Last question, I hope….
I want to create 2D array, that’s wrong with this code?

int x,y;
 int* vector = (int*)malloc(sizeof (int) * x);
 for(int i=0;i<2; i++)
  {
    int*  vector[i]=(int*)malloc(sizeof (int) *y);
  }

I want to create 2D array, that’s wrong with this code?

A vector is a one-dimensional array.

Can you give me an example please?

Reply #5.
Your code in reply #6 simply creates vectors, and when the inner loop finishes, one will no longer exist, and you've got no way of freeing it.

I want to create 2D array, what’s wrong with this code?

Code:

int x,y;
int* vector = (int*)malloc(sizeof (int) * x);
for(int i=0;i<2; i++)
{
int* vector_[/glow]=(int*)malloc(sizeof (int) y);_
}[/quote]*
You have not defined values for x and y, so they will contain garbage. You are then defining an array of garbage size.
You are declaring a local variable, vector, in the for loop. It will go out of scope when the loop ends. The variable is an array of pointers to ints that you are trying to value with a single pointer to int, of garbage size.
Do you realize how much (actually, how little) SRAM the Arduino has for arrays?
If you correctly define vector, which, as AWOL points out, is a lousy name for a 2D array, you will need to pass the dimensions to any function that uses that array, and to free the memory used by the array when you are done with it.