diffrence between "function pointer" and "pointer to a function"

M

murgan

Hi people,
i am new to this group,this is my first query,

friends i want to know the difference between "function pointer" and
"pointer to a function" in c lang, so friends please send the answers
as early as possible, thanking u all


vijay
 
K

Keith Thompson

murgan said:
friends i want to know the difference between "function pointer" and
"pointer to a function" in c lang, so friends please send the answers
as early as possible, thanking u all

As far as I know, they're just two different ways of saying the same
thing.

Please use proper capitalization, and avoid abbreviations like "u" for
"you"; they make your text more difficult to read.
 
K

kishore_mca330

function pointer means function returning pointer.
1)int * add(int x,int y)
{
int z;
z = x+y;
return(&z);
}
we may put a function call as follows
int *a;
a = add(x,y);

2)pointer to a function is a function whic in turn points to another
function.
like
int add();
int (*addi)();
addi =&add;
then (*addi)() represents add();

this is the difference b'wn function pointer and pointer to a function.
 
R

Richard Heathfield

(e-mail address removed) said:
function pointer means function returning pointer.

No, it doesn't.
2)pointer to a function is a function whic in turn points to another
function.

No, it isn't.
this is the difference b'wn function pointer and pointer to a function.

No, it isn't.

A pointer to a function is a pointer that points to a function. A function
pointer is a pointer that either has an indeterminate value, or has a null
pointer value, or points to a function.
 
F

Flash Gordon

(e-mail address removed) wrote:

Please provide context. See http://cfaj.freeshell.org/google/
function pointer means function returning pointer.

No, when people say function pointer they normally mean a pointer to a
function. At least, that has been the case every time I've seen the term
used (and I've both seen and used it a fair bit) it has meant a pointer
to a function.
1)int * add(int x,int y)

This I ouw call a function returning a pointer to in, or if I'm not
bothered about the type a function returning a pointer.
{
int z;
z = x+y;
return(&z);
}
we may put a function call as follows
int *a;
a = add(x,y);

2)pointer to a function is a function whic in turn points to another
function.
like
int add();
int (*addi)();
addi =&add;

You don't need the & although it does no harm.
then (*addi)() represents add();

this is the difference b'wn function pointer and pointer to a function.

Maybe the way you use the terms, but that is not what I've come across
in far too many years of programming in many languages.
 
J

John Bode

murgan said:
Hi people,
i am new to this group,this is my first query,

friends i want to know the difference between "function pointer" and
"pointer to a function" in c lang, so friends please send the answers
as early as possible, thanking u all

They're just two different ways of describing the same thing as far as
I know.
 
T

Thad Smith

Richard said:
(e-mail address removed) said:


No, it doesn't.



No, it isn't.

He, he, when I read kishore's response, I swear there was a line saying
<enable twisted homework response mode>. Maybe that didn't come though
on your copy. ;-)
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top