What differs these 2 codes?
#2

Using format to copy strings is horrible. Also that second method would probably give a runtime error, as you're trying to format a string into a destination that is too small too hold the entire string. Whereas if you'd do:
pawn Код:
new test2[5] = "Hello";
The compiler would throw an error: error 018: initialization data exceeds declared size

The first method just assigns the string "Hello" to the array called test1. At compile time, the compiler will calculate the size of this array and it will be compiled as:
pawn Код:
new test1[6] = "Hello";
Reply


Messages In This Thread
What differs these 2 codes? - by iTorran - 25.02.2012, 11:47
Re: What differs these 2 codes? - by Vince - 25.02.2012, 11:55
Re: What differs these 2 codes? - by Gh05t_ - 25.02.2012, 12:08

Forum Jump:


Users browsing this thread: 1 Guest(s)