Raised This Month: $ Target: $400
 0% 

Get size of a certain dimension of an array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Particlman
Member
Join Date: Nov 2005
Old 12-23-2008 , 15:58   Get size of a certain dimension of an array
Reply With Quote #1

Is there a way in pawn to get the size of one of the dimensions of an array.

I want to get how long the 2nd dimension is, so if I want to add a new rank/level I wouldn't have to have the RANKS[][MAXRANKS][] variable in there that I would have to edit each time.It would just edit the maxranks for me.
Obviously if it is not possible it is one little number I would have to change to add a new rank so no big deal.

PHP Code:
new const RANKS[][][] = {
    {
"Civilian""Recruit""Recruit"},
    {
"Civilian""Private""Private"},
    {
"Civilian""Private First Class""Private First Class"},
    {
"Civilian""Specialist""Lance Corporal"},
    {
"Civilian""Corporal""Corporal"},
    {
"Civilian""Sergeant""Sergeant"},
    {
"Civilian""Staff Sergeant""Staff Sergeant"},
    {
"Civilian""Sergeant First Class""Gunnery Sergeant"},
    {
"Civilian""Master Sergeant""Master Sergeant"},
    {
"Civilian""Sergeant Major""Sergeant Major"}


Last edited by Particlman; 12-23-2008 at 16:01.
Particlman is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-23-2008 , 16:16   Re: Get size of a certain dimension of an array
Reply With Quote #2

Using your exemple :

sizeof RANKS will return 10
sizeof RANKS[] will return 3
Arkshine is offline
Particlman
Member
Join Date: Nov 2005
Old 12-23-2008 , 17:44   Re: Get size of a certain dimension of an array
Reply With Quote #3

I love how helpful this place is, and how fast people respond to questions.

Thanks for the help
Particlman 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 09:07.


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