Jump to content

Pointer to pointer and pointer in function

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Max.89

Max.89

    Newbie

  • Members
  • Pip
  • 9 posts
I know these kind of questions are quite frequent,but still I have some doubts...

From main() I create a struct variable and I pass his address(&) to a function
(this function has a pointer type argument).
Now how can I pass, from this function, the pointer to the struct variable I created from main()?

f(*struct);

f2(*struct);


main()

{

  struct a;


  f(&a);

}


f(*struct a)

{

  f2(what should I write here to pass the pointer?)

}

Should I use a pointer to pointer?
Pointer to pointer are quite confusing can I have some examples or some tutorials?
Thanks in advance.

Edited by Max.89, 03 April 2009 - 07:47 AM.


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
f2(struct)
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Max.89

Max.89

    Newbie

  • Members
  • Pip
  • 9 posts
Sorry I forgot names for arguments

Should I write f2(a)?

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Yes.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog