Raised This Month: $ Target: $400
 0% 

sizeof() multi-dimensional arrays


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 11-06-2011 , 18:32   sizeof() multi-dimensional arrays
Reply With Quote #1

Hey guys,

im confused about something and i want to understand something that is wierd to me now.

Lets say I declared a multi-dimensional array:

PHP Code:
new variable[100][500
Now, I want to know the length of each array in the arrays (like, there is an array of arrays, and I want to know the length of each array in the array of arrays, which is 500)

From what I know, I should do it like this:

PHP Code:
sizeof(variable[0]) 
But I get compiler errors, and I can only do:

PHP Code:
sizeof(variable
Why is that? I try to think but it's confusing, I mean, sizeof(variable) isnt supposed to give me the length of the array of arrays? which is 100. but what do i do to get the returned value of 500? (the size of each array within the array of the arrays)
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-06-2011 , 18:35   Re: sizeof() multi-dimensional arrays
Reply With Quote #2

sizeof(variable[])
__________________
Arkshine is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-06-2011 , 18:49   Re: sizeof() multi-dimensional arrays
Reply With Quote #3

And if you have a three dimensional array:

sizeof( variable[][] )
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 11-06-2011 , 20:29   Re: sizeof() multi-dimensional arrays
Reply With Quote #4

Thank you.
__________________
My Projects:

Auto-Mix (Pug): 100%

Joined the Military (a soldier now) - Inactive
Diegorkable is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode