• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Set the size of an array based on another
#1
Hello, I know that the size of an array must be defined by a constant, but is there any way to define the size based on a parameter or another array?

PHP Code:
stock GetStringPreview(string[],maxlength=25) { new preview[maxlength+3],len; format(preview,maxlength,"%s",string); if(strlen(string) > maxlength) { len = strlen(preview); strins(preview, "...",((preview[len-1] == ' ') ? len-1 : len)); } return preview; }
  Reply
#2
// Setting
#DEFINE ARRAY_SIZE 40

// Another array size
new another_array[40];
new array[sizeof(another_array)];
  Reply