Sign in to follow this  
Alternate-E

Two-dimensional array map error

Recommended Posts

Alternate-E    215

How's it going everyone,  I'm having some bug issues with a two-dimensional array I'm using for a general map layout.  Hell, actually the whole functiion seems kooky.  MAP_WIDTH and MAP_HEIGHT are both pre-defined as well as a prototype for the function itself.  Every other function in the code seem to be working except this one (but you know how C is).  The errors are:

 

main.c: In function ‘main’:
main.c:33:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
main.c:34:69: error: expected ‘;’ before ‘}’ token
main.c:34:70: error: expected expression before ‘,’ token
main.c:57:5: error: expected ‘;’ before ‘{’ token

 

all of which I've gotten before,  which leads to think it has something to do with line 33.  I've tried random little things like semicolons after the closing ( } ) curly bracket but no luck.  Anything I'm missing here?  I don't do these often.

 

int aMapArray[MAP_HEIGHT][MAP_WIDTH] {
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
 }

Edited by iGoogleThis

Share this post


Link to post
Share on other sites
Alternate-E    215

You're missing an = before the first {.

laugh.png  winnn thanks a lot!

 

You're missing a ; after the last }.

So that was part of the solution!  Thanks!  Sure enough that did it. 

 

Nothin' better than a successful compile, drinks on me.

Share this post


Link to post
Share on other sites
Khatharr    8812

We need a forum badge system that includes the badge 'Eagle-Eye'. I started at that line for a full 215 seconds and totally missed the '=' not being there.

 

Maybe it's bedtime...

Share this post


Link to post
Share on other sites
SiCrane    11839
It's not that hard if you read the error message, which basically says a { isn't legal here, but you can use an = (or a ,; [tt]asm[/tt] or [tt]__attribute__[/tt]).

Share this post


Link to post
Share on other sites
Khatharr    8812

It's not that hard if you read the error message, which basically says a { isn't legal here, but you can use an = (or a ,; [tt]asm[/tt] or [tt]__attribute__[/tt]).

 

Yeah, that's why I was staring at that line. I think I was just sleep deprived. I was failing pretty hard at LoL last night too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this