External: SIGSEGV lazarus / 62-General ---------------------------------------------------------------------- tgd · 2015-09-22 10:34 Hi, I'm not sure if this is the right section for this, but here it is: Code: [Select]program project1; var a,b,n:integer; mat:array of array of real; F:textfile; begin   write('n=');   readln(n); setlength(mat,n,n); assign(F,'C:\Users\Julius\Desktop\fps\aaa.txt'); reset(F); for a:=1 to n do     for b:=1 to n do         read(F,mat[a,b]); close(F); end. The program is supposed to compute the inverse matrix to the matrix from the text file. I actually wrote the whole thing and it works, but now I'm trying to use dynamic arrays. When I run the program, I choose the n value, press enter and get an error message saying that project1 raised exception class External:SIGSEGV at the line with 'read(F,mat[a,b]);'. Any help would be appreciated. Thanks. ---------------------------------------------------------------------- Jonas Maebe · 2015-09-22 11:14 The indices in a dynamic array run from 0 to length-1, not from 1 to length. The safest way to iterate over all array positions, which works with any kind of array, is to always use something like Code: [Select]for a:=low(mat) to high(mat) do   for b:=low(mat[a]) to high(mat[a]) do      ... ---------------------------------------------------------------------- tgd · 2015-09-22 11:27 It works now, thanks a lot!