kostas_koz

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)'

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

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.

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored.I speak for myself, not Arduino.

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.