Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

GARARHG

Name: Anonymous 2010-10-22 10:38

const char const *f;
Ok so that means that I can't do pointer arithmetic or change the contents of what the pointer points to.

So
const char *f;
means that I can't change where the pointer points to but I can change the contents of what it points to.

So does that mean that
char const *f allows me to do pointer arithmetic but I can't write to whatever f points to?

Name: Anonymous 2010-10-22 10:40

const considered harmful

Name: Anonymous 2010-10-22 10:40

>>1
The other way around.

Name: >>2 2010-10-22 10:40

Name: Anonymous 2010-10-22 10:42

This thread has peacefully ended, it seems.

Name: Anonymous 2010-10-22 10:44

>>4
Awesome thanks

Name: Anonymous 2010-10-22 10:50

>>4
char const *x
syntax error

Name: Anonymous 2010-10-22 11:10

>>7
char *const x
You know, it was an interesting experiment, but I can see why this ``declare it as you'd use it'' concept didn't catch on.

Name: Anonymous 2010-10-22 11:22

- const char const *f; is a syntax error.
- const char *f; means you can modify f but not *f.
- char const *f; is the same as the above.
- char *const f; means you can modify *f but not f (except for initialization).
- const char *const f; (or char const *const f;) means you can modify neither *f nor f (except for initialization).

Name: Anonymous 2010-10-23 9:34

>- const char *f; means you can modify f but not *f.
- char const *f; is the same as the above.
IHBT

Name: Anonymous 2010-10-24 9:25

lol c

Don't change these.
Name: Email:
Entire Thread Thread List