For arrays, C considers everything except the first dimension to be
part of the type.  That's necessary because an array variable just
points to a chunk of memory somewhere, and to work out where in that
chunk of memory you're trying to access, it needs to know the size of
the other entries in the array.  There's no way to divine that
information from just a pointer, so the compiler requires you to
supply them.

If you've used java or C#, you know they don't have that problem
because arrays are full-blown objects and their size is always known
to the runtime environment.


On 12/1/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Gah, I am not surprised I figured out the problem 5 minutes I send it to the
> list.
>
> Though, to create some discussion on the list, I will ask this:
>
> Why cannot we define like so:
> void blah(char token[][])
> but:
> void blah(char token[][size])?
>
> Enlighten me! :D
>
>
>
> Quoting [EMAIL PROTECTED]:
>
> >
> >
> > So, I am trying to pass a 2D char variable to a function and then do some
> > stuff
> > with it. However, I am receiving this error and I am not quite sure why:
> >
> > "arithmetic on pointer to an incomplete type"
> >
> > Poking around the internet hasn't lead me to anywhere interesting. I thought
> > it
> > was just my compiler on the linux box so I wrote a test program in dev-c++ 
> > so
> > we can see if that was so. This is written and is compiled in C:
> >
> > void blah(char token[][]);
> >
> > int main()
> > {
> >         char token[1][1];
> >
> >         token[0][0] = 'c';
> >
> >         blah(token);
> >
> >         return 0;
> > }
> >
> > void blah(char token[][])
> > {
> >                     printf("token: %c\n", token[0][0]);
> > }
> >
> > It generates the same error.
> >
> > I am assuming, as usual, that it is something obvious and after spending
> > hours
> > (a good 4 hours straight) smashing my keyboard my eyes have gone out of
> > control!
> >
> > Thank you!
> >
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> --
> ROM mailing list
> [email protected]
> Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
--
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

Reply via email to