Help Understanding Array Lenght -
iSteve - 07.04.2014
Hello People
I have recently Started Coding.
So I Really Wanted to Know what array lenght Shall be chosen for the UserName Field.
And
How Does Higher lenghts Affect the processing of code?
Re: Help Understanding Array Lenght -
Mriss - 07.04.2014
The Array Length Should be 24
As it is the Maximum Characters allowed in a name.
Re: Help Understanding Array Lenght -
iSteve - 07.04.2014
But isn't the max player name of 20 characters?
Then why is the length 24?
Re: Help Understanding Array Lenght -
Mriss - 07.04.2014
The MaxPlayerName is 24
Re: Help Understanding Array Lenght -
RajatPawar - 07.04.2014
Quote:
Originally Posted by iSteve
Hello People
I have recently Started Coding.
So I Really Wanted to Know what array lenght Shall be chosen for the UserName Field.
And
How Does Higher lenghts Affect the processing of code?
|
Higher lengths - more cells allotted, and more memory is wasted. (Imagine you need only 128 chairs for a party with 128 or less people, but you instead set up 1024 chairs. So much space wastage!)
Quote:
Originally Posted by iSteve
But isn't the max player name of 20 characters?
Then why is the length 24?
|
The length was 20, it was increased to 24, IIRC.
Re: Help Understanding Array Lenght -
iSteve - 07.04.2014
Ok thanks Rajat!
Can I conclude that every character I need to use requires 1 array length?
Re: Help Understanding Array Lenght -
RajatPawar - 07.04.2014
Kind of, yes. There is no actual string datatype in PAWN unlike some other languages, you must use arrays for that purpose.
Check out the below example, I've used 3 different methods to print the same character. (a)
There may be more.
pawn Код:
new c = 97, // ASCII code for 'a'
a[1] = 'a', // Direct array assignment
holder = 'a'; // Direct
main() {
printf("%c", c);
printf("%c", a);
printf("%c", holder);
}
If you don't know what %c does in printf, check
this page out. It is a specifier for printing characters.
Re: Help Understanding Array Lenght -
iSteve - 07.04.2014
Thanks for this
And yea I know about specifiers ... That was one of the computer classes I hadn't bunked
Thanks for the help guys