Home > C Programming, C++, VC++ > typedef a fixed length array

typedef a fixed length array

Let’s suppose you wanna create a typedef for a fixed length array, so first thing that you would do is this…

typedef char[100] HundredChars;

This will not work as typedefing an array requires different syntax, here is how we do it…

typedef char HundredChars[100];
Advertisements
  1. spencer
    March 2, 2010 at 4:03 am

    shouldn’t this be called HundredAndOneChars? ;p

  2. September 4, 2008 at 9:59 am

    Yeah hope so! I guess this is the standard syntax.

  3. Sivaraj
    September 4, 2008 at 9:44 am

    Will this comply across all compilers?

  1. January 6, 2011 at 2:46 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: