pointers and functions

Y

Ying Yang

Hi,

Consider this function:

Node2* insertNode (Node1* node){
...
}


What is this function returning exactly?

1. a pointer of type Node2 OR
2. the contents of what Node2 references.

I think 1.


wewewewe
 
S

Sumit Rajan

Ying said:
Hi,

Consider this function:

Node2* insertNode (Node1* node){
...
}


What is this function returning exactly?

1. a pointer of type Node2 OR
2. the contents of what Node2 references.

I think 1.

insertNode returns a pointer to Node2

Sumit.
 
H

Howard

Ying Yang said:
Hi,

Consider this function:

Node2* insertNode (Node1* node){
...
}


What is this function returning exactly?

1. a pointer of type Node2 OR
2. the contents of what Node2 references.

I think 1.

It doesn't actually return "a pointer of type Node2". It returns "a
pointer to an object of type Node2". (But of course, it could return nil as
well, which technically doesn't point to anything.)

Saying "a pointer of type Node2" tends to imply that Node2 is a pointer
type and a pointer of that type is being returned, whereas here you are
returning a pointer, and what it points to is an object whose type is Node2.
But maybe I'm just being picky. :)

-Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top