Thread: Look Up Tables
View Single Post
  #8   Spotlight this post!  
Unread 09-03-2005, 00:14
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
Re: Look Up Tables

Quote:
Originally Posted by ace123
The code
Code:
int val = *((&table) + index);
is equivalent to
Code:
int val=table[index];
In fact, I think they compile down to the same code at the end.
Technically, that should be
Code:
int val = *(table + index);
because table is a pointer by default. Writing
Code:
int table[];
is just short hand for
Code:
int *table;
Sorry for being pedantic but in programming it can be important.

Matt

Last edited by Matt Leese : 09-03-2005 at 00:14. Reason: Too much whitespace