Two-dimensional array map error

Started by
6 comments, last by Khatharr 11 years, 1 month ago

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},
 }

Editor // Joy-Toilet.com

Anything But Shitty Entertainment!

Advertisement
You're missing an = before the first {.

You're missing a ; after the last }.

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.

Editor // Joy-Toilet.com

Anything But Shitty Entertainment!

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...

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
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 ,; asm or __attribute__).

Yeah it was definitely a late-night what-am-I-missing.. error.

Editor // Joy-Toilet.com

Anything But Shitty Entertainment!

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 ,; asm or __attribute__).

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.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement