SA-MP Forums Archive
[SOLVED]warning 224: indeterminate array size in "sizeof" expression (symbol "") - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED]warning 224: indeterminate array size in "sizeof" expression (symbol "") (/showthread.php?tid=115017)



[SOLVED]warning 224: indeterminate array size in "sizeof" expression (symbol "") - LarzI - 22.12.2009

Hi all!
I've searched and checked every single topic within the results, but never found a 100% working solution.

This warning is pretty known in this case, but I just wanna know how to fix, if anybody knows...

To the problem...
If you have an array with no cell size (myVar[]) and you try to use sizeof with the array, you will get this warning
Code:
warning 224: indeterminate array size in "sizeof" expression (symbol "")
My "example" is in OnPlayerText, when I try to format the text[] var.
I can't use 128 as len (or so I've heard), and sizeof gives this error.

Any solution?

(Here's the line)
pawn Code:
format( text, sizeof( text ), "Sometext %s", text );
This gives the warning (since the size of 'text' is unknown)

Please help me guys :'P
I really want this to work.

(As I said, I've heard some "rumours" that 128 is "incorrect")

Thanks.
- lrZ^


Re: warning 224: indeterminate array size in "sizeof" expression (symbol "") - [HiC]TheKiller - 22.12.2009

I'm not fully sure, but wouldn't it work like this?

pawn Code:
format(text, strlen(text) + 9, "Sometext %s", text);
strlen gives the length of the text, I'm pretty sure it would work in this case .


Re: warning 224: indeterminate array size in "sizeof" expression (symbol "") - LarzI - 22.12.2009

Probally.
Never thought about that, lol.
Ty for helping :]
Problem solved (I guess)