What is int**

What is int**

Page 1 of 1

6 Replies - 342 Views - Last Post: 04 January 2012 - 08:07 PM Rate Topic: -----

#1 menukadevinda  Icon User is offline

  • D.I.C Regular

Reputation: -7
  • View blog
  • Posts: 470
  • Joined: 14-April 11

What is int**

Posted 04 January 2012 - 11:40 AM

hi what is the meaning of int**
normally int * means pointer to integer. but I dont know int **

I am a beginer...
Is This A Good Question/Topic? 0
  • +

Replies To: What is int**

#2 jimblumberg  Icon User is online

  • member icon


Reputation: 4013
  • View blog
  • Posts: 12,389
  • Joined: 25-December 09

Re: What is int**

Posted 04 January 2012 - 11:46 AM

It means a pointer to a pointer to an int.

Jim
Was This Post Helpful? 1
  • +
  • -

#3 Invisibledeath  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 79
  • Joined: 13-March 10

Re: What is int**

Posted 04 January 2012 - 02:33 PM

View Postjimblumberg, on 04 January 2012 - 11:46 AM, said:

It means a pointer to a pointer to an int.

Jim

Exactly that. However if you want to simplify **int this write it like this *(*int) Look at order of operations and you get pointer to int pointer.
Was This Post Helpful? 1
  • +
  • -

#4 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: What is int**

Posted 04 January 2012 - 02:48 PM

when did the '*' type operator become a prefix operator?
Was This Post Helpful? 0
  • +
  • -

#5 jimblumberg  Icon User is online

  • member icon


Reputation: 4013
  • View blog
  • Posts: 12,389
  • Joined: 25-December 09

Re: What is int**

Posted 04 January 2012 - 03:05 PM

Quote

when did the '*' type operator become a prefix operator?

So maybe I'm dyslexic. (corrected the title I gave this thread when I split it from another topic).

Jim

This post has been edited by jimblumberg: 04 January 2012 - 03:21 PM
Reason for edit:: Fixed Title

Was This Post Helpful? 0
  • +
  • -

#6 r.stiltskin  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1833
  • View blog
  • Posts: 4,927
  • Joined: 27-December 05

Re: What is int**

Posted 04 January 2012 - 03:14 PM

I guess ishkabible's mysterious comment refers to the fact that the question in post #1 was about int** (which jimblumberg answered), but the topic title and Invisibledeath's post both refer to **int.

When you declare a variable, for example
int** ppi;

you are declaring a pointer to a pointer to an int.

On the other hand a line of code that begins with
**int

is invalid and will evoke a compiler error message.

On the other (third?) hand, if I have already declared a variable int** ppi and assigned a valid value to it **ppi will dereference the pointer so
[code]cout << **ppi << endl;[/il]
will print the int value that is pointed to by the int pointer that is pointed to by the "pointer to pointer to int" ppi,

edit: OK, now someone's making me seem dyslexic. When I started this post, the topic heading was What is **int, but now it's been edited to What is int**.

This post has been edited by r.stiltskin: 04 January 2012 - 03:18 PM

Was This Post Helpful? 1
  • +
  • -

#7 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: What is int**

Posted 04 January 2012 - 08:07 PM

Quote

I guess ishkabible's mysterious comment refers to the fact that...

ya; sorry I was a bit unclear. the type system has type constructors(pointer, function, array, etc...) that take the form of operators(that look like closely related data operators). the type constructor to make a pointer is a post-fix unary operator(unlike the dereference operator which is prefix). so i called the pointer constructor a "type operator" and asked when it became prefix to contrast reality. so ya, you hit the nail on the head.

This post has been edited by ishkabible: 04 January 2012 - 08:12 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1