Raised This Month: $ Target: $400
 0% 

Get sizeof array in a macro


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-22-2018 , 04:20   Re: Get sizeof array in a macro
Reply With Quote #1

#define calculateArray2D(%1,%2,%3) _calculateArray2D(%1,%2,sizeof %3)

stock _calculateArray2D(array[][], num, size)
{
//some unimportant stuff here
}

Example >> calculateArray2D(2Darray[0], 2, 2Darray[])

Am not sure what are you trying to do it really depends on it.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-22-2018 at 04:22.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
shauli
Member
Join Date: Jun 2018
Old 06-22-2018 , 10:22   Re: Get sizeof array in a macro
Reply With Quote #2

Quote:
Originally Posted by Natsheh View Post
#define calculateArray2D(%1,%2,%3) _calculateArray2D(%1,%2,sizeof %3)

stock _calculateArray2D(array[][], num, size)
{
//some unimportant stuff here
}

Example >> calculateArray2D(2Darray[0], 2, 2Darray[])

Am not sure what are you trying to do it really depends on it.
I am trying to get the size of an array inside my include file without using an extra parameter. Is it possible?

Since you can't directly use 'sizeof' (gives error) I tried to it with a macro. It works fine, but only when I use 1 dimensional arrays.
shauli 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 04:43.


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