🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2426

Re: const pointer confusion...

#2426
From: Ari Lukumies
Date: Thu, 28 Mar 1996 12:47
23 lines
1278 bytes
Jerry Coffin wrote:
> 
> > 2) int *const p;
> >       p is a pointer to an integer.  *p can be assigned to, but p can
> >       never be made to point to another address in memory, right?
> 
> Nope.  Just the reverse - the pointer can't be modified to point at something
> else, but you can modify what it points at.
> 

Isn't that what he said? FWIW, I've found it intuitive to read the syntax from right 
to left:

	const int *p; = pointer to integer constant
	int const *p; = pointer to constant integer (same as above)
	int *const p; = constant pointer to integer
	const int *const p; = constant pointer to integer constant
	int const *const p; = constant pointer to constant integer (same as above)

Later,
 AriL
-- 
All my opinions are mine and mine alone.
Technical Details
Message-ID: <4je1pf$g2a@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4j06gm$7oa@solutions.solon.com> <4j633s$3e7@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
Newsgroups: comp.lang.c.moderated
Subject: Re: const pointer confusion...
Date: 28 Mar 1996 06:47:43 -0600
Organization: Carelcomp Products
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4je1pf$g2a@solutions.solon.com>
References: <4j06gm$7oa@solutions.solon.com> <4j633s$3e7@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Mailer: Mozilla 2.0 (WinNT; I)