Problem With arrays and variables
#1

Hi i know i have posted a lot recently asking questions, but I could do with a pointer with this, I get an error with this code:
Код:
error 049: invalid line continuation
error 052: multi-dimensional arrays must be fully initialized
Код:
new RankWeaponsSet1[8][6] =
{
//sidearm - prime - secon - sdamo - pramo - secamo\\
	{1,  	1, 	1, 	1,  	1,  	1}, <<<<< Error 49
	{22, 	29, 	4,	17*3, 	30*3, 	1}, 
	{22, 	29, 	4, 	17*4, 	30*4, 	1}, 
	{22, 	30, 	28, 	17*5, 	30*3, 	100*2}, 
	{24, 	30, 	18,	17*3, 	30*4, 	3},   
	{24, 	31, 	18, 	17*4, 	50*2, 	5},      
	{24, 	31, 	16, 	17*5, 	50*3, 	3},      
	{24, 	31, 	16, 	17*6, 	50*4, 	5}      
}; <<<<<<<<<<<<Error 52
I think im doing something wrong with the ';' and ',' it wil be simple but i've tried a lot!

thanks for any replies
Reply
#2

This problem stems from a little known feature of the compiler relating to line continuations:

pawn Код:
#define A \
    27
That is a valid define because the "\" means "continued on next line". In your code you end the comment with "\\", which tries to tell the compiler to continue the comment on the next line, but you can't do that with comments, hence the first error. The second is likely just a result of the first error (whenever you get a lot of errors ALWAYS fix the first one and try recompile - it's often the case that the others are caused by the first). Also, this is covered in pawn-lang.pdf had you bothered to look there.
Reply
#3

I knew it would be simple! I always have the simplest of errors that I can't fix! lol I must look like an idiot!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)