Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > can anybody telle me this

Reply
Thread Tools

can anybody telle me this

 
 
c beginner
Guest
Posts: n/a
 
      06-17-2007
i have a confusion about pointer to functions.can anybody help me to
overcome my confusion??

 
Reply With Quote
 
 
 
 
Carramba
Guest
Posts: n/a
 
      06-17-2007
c beginner skrev:
> i have a confusion about pointer to functions.can anybody help me to
> overcome my confusion??
>

this may do:
http://publications.gbdirect.co.uk/c..._pointers.html
 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      06-17-2007
c beginner said:

> i have a confusion about pointer to functions.can anybody help me to
> overcome my confusion??


What is it that is confusing you about pointers to functions?

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
Sachin
Guest
Posts: n/a
 
      06-18-2007
On Jun 17, 9:13 pm, c beginner <saheb1...@gmail.com> wrote:
> i have a confusion about pointer to functions.can anybody help me to
> overcome my confusion??


function pointer holds address of function that you have specified.
as you call function by pointer.

fp = foo(int,int);
so you can call as
*fp(1,2);

depending on requrement you just assign address of function to
pointer.
it will get executed through function pointer call.


 
Reply With Quote
 
Barry Schwarz
Guest
Posts: n/a
 
      06-18-2007
On Mon, 18 Jun 2007 08:39:50 -0000, Sachin <> wrote:

>On Jun 17, 9:13 pm, c beginner <saheb1...@gmail.com> wrote:
>> i have a confusion about pointer to functions.can anybody help me to
>> overcome my confusion??

>
>function pointer holds address of function that you have specified.
>as you call function by pointer.
>
>fp = foo(int,int);
>so you can call as
>*fp(1,2);


Don't anyone take any of this code as legitimate c.

>
>depending on requrement you just assign address of function to
>pointer.
>it will get executed through function pointer call.
>



Remove del for email
 
Reply With Quote
 
Joe Wright
Guest
Posts: n/a
 
      06-18-2007
Sachin wrote:
> On Jun 17, 9:13 pm, c beginner <saheb1...@gmail.com> wrote:
>> i have a confusion about pointer to functions.can anybody help me to
>> overcome my confusion??

>
> function pointer holds address of function that you have specified.
> as you call function by pointer.
>
> fp = foo(int,int);
> so you can call as
> *fp(1,2);
>
> depending on requrement you just assign address of function to
> pointer.
> it will get executed through function pointer call.
>
>

Not quite like that. Let's define the function foo..

int foo(int a, int b) {
return a + b;
}

Now let's define a pointer to function returning int and taking two int
arguments.

int (*fp)(int, int);

Now initialize fp..

fp = foo;

Now you call it through the pointer with..

int x;
x = fp(1, 2);

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Firefox related problem. Can anybody help with this? Jim Lewis Firefox 4 06-14-2005 11:21 PM
Where can I find a BerkeleyDB XML for .Net || Has anybody found anything about .Net and BerkeleyDB RikardN ASP .Net 0 05-28-2004 09:16 PM
can anybody give me idea how to write vhdl coding for the IFFT of 8 point senthil VHDL 0 11-21-2003 01:24 PM
anybody can help me write a DCT module? walala VHDL 1 11-19-2003 04:48 PM
NEWBIE ASKING FOR HELP! can anybody take a look at my Synopsys DC report? walala VHDL 2 09-13-2003 04:23 PM



Advertisments