473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

const ptr to const ptr ?

is that permitted? int const*const* p;

what does it mean ? meaning both pointers can only look at a constant
location and the value of the int can only change? this means no array?

Thanks
Nov 14 '05 #1
3 2291
"franco ziade" <fz****@videotron.ca> wrote in message
news:1b*********************@weber.videotron.net.. .
is that permitted? int const*const* p;


My guess is that you will never see this in practice. And if you do, head
over to that guy's cubicle with a big stick ;-)
Nov 14 '05 #2
On 2005-02-16 21:18:52 -0500, "franco ziade" <fz****@videotron.ca> said:
is that permitted? int const*const* p;

what does it mean ?

Start from the right:

p
*p ...is a pointer
const *p ...to a constant
*const *p ...pointer
const *const *p ... to a constant
int const *const *p ... int

So, altogether: "p is a pointer to a constant pointer to a constant int"
meaning both pointers can only look at a constant
location and the value of the int can only change?
(p) is not constant (i.e. you can change what p points to)
(*p) is constant (i.e. you cannot change what *p points to)
(**p) is a constant int (you cannot change its value)
this means no array?


No, it could very well be a pointer to an array of pointers.
--
Clark S. Cox, III
cl*******@gmail.com

Nov 14 '05 #3
I posted this twice - my apologies - this message to be ignored

"franco ziade" <fz****@videotron.ca> wrote in message
news:1b*********************@weber.videotron.net.. .
is that permitted? int const*const* p;

what does it mean ? meaning both pointers can only look at a constant
location and the value of the int can only change? this means no array?

Thanks

Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2573
by: Sergey Tolstov | last post by:
Hello, I am working with Visual C++ 6.0 compiler. In the following declaration: int const A = 10, B = 10; both A and B are const. However, in declaration
20
2462
by: Corno | last post by:
Hi all, There's probably a good reason why a const object can call non const functions of the objects where it's member pointers point to. I just don't see it. For me, that makes the the const...
6
2407
by: Virendra Verma | last post by:
This sounds weird, but I am looking for separate behaviors for destruction of a const and non-const object. I am trying to develop a smart/auto pointer class for writing objects to disk...
7
3778
by: johny smith | last post by:
Can someone please explain to me the difference between these two: function1( const int a) function2( int const a) Both seemed to compile, but what is the difference between the two above....
3
2213
by: Steven T. Hatton | last post by:
Sorry about the big code dump. I tried to get it down to the minimum required to demonstrate the problem. Although this is all done with GNU, I believe the problem I'm having may be more general. ...
15
4152
by: Dave | last post by:
Hello NG, It is well known that memory-allocating definitions should not be put in a header file. I believe, however, that this does not apply to const definitions. For example: #ifndef...
4
2740
by: chrisstankevitz | last post by:
This code does not compile on gcc 3.4.4. Should it? Thanks for your help, Chris //================ #include <set> int main()
10
2759
by: d3x0xr | last post by:
---- Section 1 ---- ------ x.c int main( void ) { char **a; char const *const *b; b = a; // line(9)
0
1859
by: d3x0xr | last post by:
Heh, spelled out in black and white even :) Const is useles... do NOT follow the path of considering any data consatant, because in time, you will have references to it that C does not handle,...
4
6672
by: grizggg | last post by:
I have searched and not found an answer to this question. I ran upon the following statement in a *.cpp file in a member function: static const char * const pacz_HTMLContentTypeHeader =...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.