View Single Post
Whai
Senior Member
Join Date: Jul 2018
Old 07-09-2019 , 16:29   Re: how can you scan a variable and then apply it?
Reply With Quote #13

Well,

char value[4] is an array of char (char is the abbreviation of characters) with the size of 4 but there is an exception only on arrays of char.

First, index of arrays go from 0 to the size - 1, that means if you create an array with the size of 4 (meaning you'll have 4 places to store item) : it will go from 0 to 3.
However, on arrays of char (in sourcemod or maybe others programming languages) the last index is reserved to place the "\0" --> it means the end of the "word".

By creating an array of char with the length of 4, you will have 3 free places.

In conclusion, yes : if you write "15" you need at least 2 free places.

Note : I wrote all of this to make this for you understand roughly speaking how works array in SM
__________________

Last edited by Whai; 07-09-2019 at 16:32. Reason: readable
Whai is offline