Explain me.. ;]
#1

Can you explain me what means that numbers? string[128]; string[256]; and others..;]
Reply
#2

Search in wiki about strings. But for example:
"search" has 6 leters, so string will be: string[7];
Reply
#3

Can you tell me that link? Because I can't find it.
Reply
#4

When using string[128]; - the variable has 128 cells (not sure) space for characters, that means you can input upto 128 characters into that variable. (Alphabetic characters and numeric characters.)
When using string; - the variable can only be an integer, a number, that means it cannot contain any type of characters.
Reply
#5

So it doesn't matter wich number I would write: 64, 128, 256 and others..?
Reply
#6

It all depends on the context. If it's a message you'll repeatedly send to a player, you may aswell stick with 128, because that is the output limit. There are very few places you'll need 256, but you're not bounded by binary numbers, so you could have 200 if you wanted. However, if you were just going to store a players name you would use MAX_PLAYER_NAME (Which I think is 24) as anything else would be a waste!
Reply
#7

And when using strings, always declare the number of cells for one more then the max number you will use: e.g. If you want to save a word with 99 characters, declare a string with 100 cells, because in the last cell there needs to be the "/0" character which basicly marks where the string ends, so the system will know how much to print out. Also, when getting characters out of strings, the cells always start with 0: e.g. if you declare chars[3];, you can only save characters in the cells char[0], char[1] and char[2]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)