View Single Post
shauli
Member
Join Date: Jun 2018
Old 06-13-2018 , 05:24   Re: Get sizeof array in a macro
Reply With Quote #3

Quote:
Originally Posted by ^SmileY View Post
you can check sizeof array into _calculateArray stock, why you need to pass it?

also what you need to do with new array[4][6]; exactly?
This stock is inside my include file which I use in many different plugins that are not related to one another. Just a custom-made include.

When I try to use sizeof inside the stock (in the include file) I get this error:
Code:
WARNING [25]: indeterminate array size in "sizeof" expression (symbol "")
About the "array[4][6]" that is just an example. Here's another example that will make more sense:
PHP Code:
new values[MAX_PLAYERS+1][4];
//code......

public someStuff(id)
{
    
calculateArray(values[id], 2);
    
client_print(idprint_chat"%d"values[id][0]);

The purpose of the stock is to allow me to shuffle and "shift" indexes for the array, but that doesn't really matter because I have more stocks like this. Just wanted to know how can I use sizeof inside the stock.

Thank you for your answer!
shauli is offline