Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | jt@toerring.de (Jens Thoms Toerring) |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Typedef of a fixed length array |
| Date | 2011-06-30 16:15 +0000 |
| Organization | Freie Universitaet Berlin |
| Message-ID | <973lorF328U1@mid.uni-berlin.de> (permalink) |
| References | <6657b661-4ea7-47d3-94c4-28e415060a29@34g2000pru.googlegroups.com> |
raphfrk@gmail.com <raphfrk@gmail.com> wrote:
> Is there a way to define a typedef to be an array of fixed length?
Did you consider
typedef int array_of_10_ints[ 10 ];
int main( ) {
array_of_10_ints x;
size_t i;
for ( i = 0; i < sizeof x / sizeof *x; i++ )
x[ i ] = i;
...
The real challenge would be to typedef an array of variable
length, I guess;-)
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Typedef of a fixed length array "raphfrk@gmail.com" <raphfrk@gmail.com> - 2011-06-30 08:41 -0700
Re: Typedef of a fixed length array jt@toerring.de (Jens Thoms Toerring) - 2011-06-30 16:15 +0000
Re: Typedef of a fixed length array James Kuyper <jameskuyper@verizon.net> - 2011-07-01 06:50 -0400
csiph-web