Sizeof and charsmax?
I got a question
If I were to do this: Code:
new array[32]Code:
new array[32] |
Re: Sizeof and charsmax?
sizeof(array) = 32
charsmax(array) = 31 |
Re: Sizeof and charsmax?
Oh, is that the only difference? Or would you use each of them in different cases?
|
Re: Sizeof and charsmax?
charsmax = sizeof - 1
same work :D |
Re: Sizeof and charsmax?
Quote:
sizeof() can be used in many many places. Depends on what you need. |
Re: Sizeof and charsmax?
sizeof() returns the size of an array. (# of cells)
charsmax() is a macro for sizeof()-1. string.inc PHP Code:
When working with arrays and you need to access every cell in the array in a loop or w\e, you would use sizeof(). PHP Code:
|
Re: Sizeof and charsmax?
Thx @all
|
Re: Sizeof and charsmax?
Hi, sorry I'm opening this post again, is that it is perfect for my doubts. Well Im quite a beginner in programming and Im trying to understand the functions, have doubts about charsmax and sizeof, dont know how to use more actually dont know how to use such as didnt understand a part of this new code "array32 readargv (1, array, charsmax (array))" which means the number 1?. I pray for those who try to help me, I ask you to explain in great detail because I have difficulty in understanding because I dont speak English and use translators to understand, and the translations are bad. Who help me thank you of heart
|
Re: Sizeof and charsmax?
The first parameter (1) has nothing to do with charsmax or sizeof - they are quite different things. This is a paramter for the readargv native itself. It means you read the first arg after the command, or in other words - the first word written. And you store that word into the variable, where you already use charsmax().
|
Re: Sizeof and charsmax?
Quote:
ahh, so could you explain to me when I put the (1) argument? If I could say as I would use the for, charsmax and sizeof? |
| All times are GMT -4. The time now is 22:01. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.