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

Discussion in 'C Programming' started by murgan, Dec 19, 2005.

1. ### murganGuest

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

murgan, Dec 19, 2005

2. ### Keith ThompsonGuest

Re: diffrence between "function pointer" and "pointer to afunction"

"murgan" <> writes:
> 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

--
Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.

Keith Thompson, Dec 19, 2005

3. ### Guest

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

2)pointer to a function is a function whic in turn points to another
function.
like

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

, Dec 19, 2005
4. ### Richard HeathfieldGuest

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.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)

Richard Heathfield, Dec 19, 2005
5. ### Flash GordonGuest

wrote:

> 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;
>
> 2)pointer to a function is a function whic in turn points to another
> function.
> like

You don't need the & although it does no harm.

>
> 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.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.

Flash Gordon, Dec 19, 2005
6. ### John BodeGuest

murgan wrote:
> 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.

John Bode, Dec 19, 2005

Richard Heathfield wrote:

> 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.

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