O'Reilly logo

Expert C Programming: Deep C Secrets by Peter van der Linden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. The Shocking Truth: C Arrays and Pointers Are NOT the Same!

 

Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration.

 
 --Stan Kelly-Bootle

Arrays Are NOT Pointers!

One of the first things that novice C programmers often hear is that “arrays are the same as pointers.” Unfortunately, this is a dangerous half-truth. The ANSI C Standard paragraph 6.5.4.2 recommends that you

Note the distinction between the declarations:

extern int *x; 
extern int y[];

The first declares x to be a pointer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required