Forum > Documentation (Maintaining -)

S variabile not a Null terminated string


Regarding the example from this wiki page, S variable is not a Null terminated string.


The variable S would be a null-terminated string if the declaration was right.

'This is a null-terminated string.'#0

is longer than 30  chars. Change the declaration to

Var S : String[40]; 

Then everything is ok.

Original code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Program three;  Var S : String[30];      P : PChar;  begin    S := 'This is a null-terminated string.'#0;    P := @S[1];    WriteLn (P);  end.

PS.: The nonsense &#39;  was done by the Forum software

Yes, that was the error - I wanted to see if someone counts the chars in the string :) .

So it should be a Bug Report against the documentation .

( and against the forumsoftware with #39 too )


[0] Message Index

Go to full version