pointers and pointing

B

Bill Cunningham

Ken said:
If "p" is a pointer, you use "p" when you want the pointer, and "*p"
when you want what it points to. (And you use "&p" when you want to
point to the pointer.)

Oh yes and when you say point to the pointer do you mean if a paramter
wants say a void ** ? The wording is beginning to confuse. Sorry.

Bill
 
B

buja

Oh yes and when you say point to the pointer do you mean if a paramter

wants say a void ** ? The wording is beginning to confuse. Sorry.

Bill

The questions you have show a serious lack of understanding of the basics of C. If you don't understand pointers, don't even bother about function parameters, call by value and other "advanced" topics.

The best advice I can give you is to buy a book on C, read it, reread it and run the examples. Quite a bit of effort, but the only way you (or anyone else) will ever learn. You cannot expect this group to teach you C question by question.
If you don't put in the effort yourself, you will not get much further than 'Hello world!'.
 
B

Ben Bacarisse

Bill Cunningham said:
[...] But I think some of the problem with this here
is documentation for certain functions. Docs don't always do well in
explaining what a function wants.

I think you may not be best placed to make such a claim. It could be
that they don't explain it well to you, but that is not at all the same
thing as not doing well (in general) at explaining what a function wants.
Seeing a parameter wants a generic pointer
can mean it wants p or *p or &p. Just depending on the function of the
function. And with a parameter that says void * makes things even worse
because it is written to take any type. I am speaking of getaddrinfo() in
particularly. It deals with struct addrinfo type.

In 2010 you posted code using getaddrinfo() that provided correct
arguments for the call. Did you understand what you'd written then?

<snip>
 
B

Barry Schwarz

Ken said:
On 4/22/2014 9:37 AM, Bill Cunningham wrote:
[...]
int *p;

Ok when do I use p and when do I use *p. That right now I am working
on.

If "p" is a pointer, you use "p" when you want the pointer, and "*p"
when you want what it points to. (And you use "&p" when you want to
point to the pointer.)

I understood that much. But I think some of the problem with this here
is documentation for certain functions. Docs don't always do well in
explaining what a function wants. Seeing a parameter wants a generic pointer
can mean it wants p or *p or &p. Just depending on the function of the

Obviously you don't understand. Since *p cannot be a pointer, how can
you include in the list of possible arguments that would satisfy a
request for a pointer. Since this has been pointed out to you
multiple times, why do you keep repeating the same erroneous
statements?
function. And with a parameter that says void * makes things even worse
because it is written to take any type. I am speaking of getaddrinfo() in
particularly. It deals with struct addrinfo type.

Since none of the parameters for getaddrinfo have type void*, you are
either mixing apples and oranges or engaging in your usual technique
of throwing out random C related topics with no regard to their
relevance.
 
B

Bill Cunningham

Barry Schwarz said:
Since none of the parameters for getaddrinfo have type void*, you are
either mixing apples and oranges or engaging in your usual technique
of throwing out random C related topics with no regard to their
relevance.

Geesh Barry you know what I mean. I was just speaking of two different
examples of two different things. Pull the bur out of your ass. The world's
not coming to an end. It seems you want to do more arguing than anything
else or about C.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top