How can i make this SDL_Rect Work?

I'd gather this is simple but I'm just doing it wrong?

CODE:
1
2
3
4
5
const int TILE_SPRITES = 12;

SDL_Rect rClips[TILE_SPRITES];
SDL_Rect *clips;
clips = &rClips;


ERROR:

1>------ Build started: Project: SDL_FIRST_RUN, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\documents and settings\scottie\my documents\visual studio 2005\projects\sdl_first_run my game -using tiling engine\sdl_first_run\main.cpp(62) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\scottie\my documents\visual studio 2005\projects\sdl_first_run my game -using tiling engine\sdl_first_run\main.cpp(62) : error C2040: 'rClips' : 'int' differs in levels of indirection from 'SDL_Rect []'
1>c:\documents and settings\scottie\my documents\visual studio 2005\projects\sdl_first_run my game -using tiling engine\sdl_first_run\main.cpp(62) : error C2440: 'initializing' : cannot convert from 'SDL_Rect *(*)[12]' to 'int'
1> There is no context in which this conversion is possible
1>Build log was saved at "file://c:\Documents and Settings\Scottie\My Documents\Visual Studio 2005\Projects\SDL_FIRST_RUN My Game -Using Tiling Engine\SDL_FIRST_RUN\Debug\BuildLog.htm"
1>SDL_FIRST_RUN - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I'm just really lost how to make this point to that :(
Last edited on
rClips is already a pointer, so you don't need to dereference it. Furthermore, (normally) you should not dereference it.
How exactly is it already a pointer?
I'm a little lost to how its already a point as if i want to dereference it, using "&" i can't can i as it will tell me as an error

error C2234: 'pClips' : arrays of references are illegal
Declaring something like
T x[y];declares x as a pointer to a static array of Ts. It's (almost) equivalent to declaring x like
T *x=new T[y];(The difference is irrelevant for now.)
I found that a rather large number of sources fail to mention the important fact that there's no "array type" in C/++, and that the "name" of the array is in fact a pointer to the actual array.
I see what you mean but i'm getting damn frustrated lol, i've been stuck on the same page of code for a good day now. I wrote out a quick test with a tile tutorial that worked on the same .cpp file. But now that I'm making it an actual game - i've broken apart the code. But I've got a few bits that need fixed here and there. So I'm a little lost what to do as posting up the full source code would look a bit messy as the base of what i have is a good 1000 lines of code. I know its not heaps but be ugly up on the boards. Guess if anyone wants to take a look i could send them the source?
Topic archived. No new replies allowed.