Raised This Month: $ Target: $400
 0% 

Sizeof 3 dimensional arrays


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
yan1255
Senior Member
Join Date: Jul 2011
Old 11-06-2015 , 11:18   Sizeof 3 dimensional arrays
Reply With Quote #1

I am using 3d arrays and i am trying to find the maximum size of a certain value inside of them but I keep getting errors when I am using 'sizeof'

Code:
#include < amxmodx >

enum _: enumfirst
{
	enum1,
	enum2,
	enum3,
	enum4
};

enum _: enumsecond
{
	enumone,
	enumtwo,
	enumthree
};

new szHello[ enumfirst ][ enumsecond ][ ] =
{
	{ "one",	{ 1, 2, 4 }, { 3,4 } },
	{ "two",	{ 1, 2, 4 }, { 3,4 } },
	{ "three",	{ 1, 2, 4 }, { 3,4 } },
	{ "four",	{ 1, 2, 4 }, { 3,4 } }
};

public plugin_init()
{
	register_plugin( "Plugin", "1.0", "Rejack" );
	
	register_clcmd( "say /max", "CmdMax" );
}

public CmdMax( const index )
{
	client_print( index, print_chat, "Sizeof: %i", sizeof szHello[ enum1 ][ enumtwo ] );
	
	return PLUGIN_HANDLED;
}
Code:
Error: Expected token: "]", but found "-identifier-" on line 35
Warning: Expression has no effect on line 35
Error: Expected token: ";", but found "]" on line 35
Error: Invalid expression, assumed zero on line 35
Error: Too many error messages on one line on line 35
How can I check the size of the value ?
__________________

Last edited by yan1255; 11-06-2015 at 12:28.
yan1255 is offline
 


Thread Tools
Display Modes

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 18:14.


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