Hi Weeb,
The forum software is 'eating' some stuff from your code because it is recognised and handled as a special tag for that software (such as underlining).
Always post code using code-tags, see
https://wiki.freepascal.org/Forum#Use_code_tagsHere is my code, the expected input is 'n_n_n', where n is integer.
And error occurred at line'
if s[u] = '_' then begin val(s[u],ti,spec_i); max_s_to_a_of_int[u] := ti; inc(len,1); end;
raised exception class 'Esternal: SIGSEGV'.
In addition to that, if you format/structure your code a little better then you are able to get a more precise indication where exactly the error occurs.
function max_s_to_a_of_int(s:string):int_a;
var
len,u,ti : integer;
spec_i : integer;
begin
len := 0;
for u := 1 to length(s) do if s[u] = '_' then
begin
val(s[u],ti,spec_i);
max_s_to_a_of_int[u] := ti;
inc(len,1);
end;
setlength(max_s_to_a_of_int, len);
end;
Other than that, I seem to be missing some type declarations ? For those it is common to prefix them with a letter T (so "tint_a" instead of "int_a")
edit: that gives you a solid
./test
Runtime error 201 at $000102B0
$000102B0 MAX_S_TO_A_OF_INT, line 10 of test.pas
And that is because your dynamic array has no length while you do store an item in it. You seem to be doing that afterwards in your code.
The compiler gives a warning about that during compilation btw:
test.pas(10,22) Warning: function result variable of a managed type does not seem to be initialized