SA-MP Forums Archive
Error: multi-dimensional arrays must be fully initialized [REP++] - 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)
+--- Thread: Error: multi-dimensional arrays must be fully initialized [REP++] (/showthread.php?tid=562250)



Error: multi-dimensional arrays must be fully initialized [REP++] - Johnny_Ionut - 07.02.2015

Hello

I have a problem with this script
pawn Код:
#define MAX_RADIO (5)

new Radio [ MAX_RADIO ] [ 5 ] [ 120 ] = {
    { "HOT 108", "http://www.hot108.com/hot108.pls" },
    { "Radio 24/7", "http://37.187.79.56:9744" },
    { "Kiss FM", "http://80.86.106.136:80" },
    { "Radio Hot", "http://mp3.radiohot.ro:8000" },
    { "Radio Taraf", "http://radiotaraf.com/live.m3u" }
};

I received this error
pawn Код:
C:\Documents and Settings\JonnY\Desktop\radio.pwn(24) : error 052: multi-dimensional arrays must be fully initialized
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Who can help me, i will give him REP++.


Respuesta: Error: multi-dimensional arrays must be fully initialized [REP++] - Zume - 07.02.2015

PHP код:
enum rEnum{
    
rName[32],
    
rUrl[120]
};
new 
Radio[][rEnum] = {
    { 
"HOT 108""http://www.hot108.com/hot108.pls" },
    { 
"Radio 24/7""http://37.187.79.56:9744" },
    { 
"Kiss FM""http://80.86.106.136:80" },
    { 
"Radio Hot""http://mp3.radiohot.ro:8000" },
    { 
"Radio Taraf""http://radiotaraf.com/live.m3u" }
};

main()
{
    for(new 
isizeof(Radio); i++){
        
printf("Name > %s - Url > %s "Radio[i][rName], Radio[i][rUrl]);
    }




Re: Error: multi-dimensional arrays must be fully initialized [REP++] - Johnny_Ionut - 07.02.2015

Solved, i put new Radio [ MAX_RADIO ] [ 2 ] [ 120 ] and works, thanks anyway.


AW: Re: Error: multi-dimensional arrays must be fully initialized [REP++] - Nero_3D - 07.02.2015

Quote:
Originally Posted by Johnny_Ionut
Посмотреть сообщение
Solved, i put new Radio [ MAX_RADIO ] [ 2 ] [ 120 ] and works, thanks anyway.
You know that you are wasting tons of memory with that ?, that will only increase your amx size, just leave all square brackets empty
pawn Код:
new Radio [ ] [  ] [ ] = {
    { "HOT 108", "http://www.hot108.com/hot108.pls" },
    { "Radio 24/7", "http://37.187.79.56:9744" },
    { "Kiss FM", "http://80.86.106.136:80" },
    { "Radio Hot", "http://mp3.radiohot.ro:8000" },
    { "Radio Taraf", "http://radiotaraf.com/live.m3u" }
};