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 6 17032
"murgan" <vi***********@gmail.com> 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
"you"; they make your text more difficult to read.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
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. ki************@yahoo.com 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) ki************@yahoo.com 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.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
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.
Richard Heathfield wrote: ki************@yahoo.com 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
on your copy. ;-)
--
Thad This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ¤ Alias |
last post by:
I have a function named
getID3info (lvwDiscInfo.SelectedItem).
What is the difference between
getID3info (lvwDiscInfo.SelectedItem)
and
Call getID3info(lvwDiscInfo.SelectedItem) ?
|
by: jack |
last post by:
Hi all,
Suppose I have a routine to find the maximum
of any *univariate* function f in the interval :
double f(double x);
double findmax(double (*func)(double), double a, double b);
Now I...
|
by: steve |
last post by:
I'm trying to create a structure of three pointers to doubles. For
which I have:
typedef struct {
double *lst_t, *lst_vc, *lst_ic;
} last_values;
I then need to allocate space for...
|
by: octavio |
last post by:
Hello members of the comp.lang.c newsgroup. Please I need you help on
the following one.
Compiling the simple code I'm getting this error message.
Why ? Please what's the correct type of the fb...
|
by: Martin Jørgensen |
last post by:
Hi,
I'm trying to move a matlab program into c language. For those who knows
matlab, this is the line I want to program in c:
hx(1:nx,1:ny) = 0; % nx=10, ny=10
It works on a 2-dimensional...
|
by: solarin |
last post by:
Hi all.
I'm writting a logger class to write all the debug/info/warning/error
messages in a file. Every time a class needs to send any message,
should send a code (int) and a message (string)....
|
by: craig |
last post by:
During construction of an object "parent", if you create a subobject
that stores a pointer to the parent (through the "this" pointer), will
that pointer be valid when the subobject is later called?...
|
by: Chen ShuSheng |
last post by:
HI,
I am now study a segment of codes:
------------------------
printf("%p\t",fp); /*add by me*/
fseek(fp, 0L, SEEK_END); /* go to end of file */
printf("%p\t",fp); ...
|
by: chutsu |
last post by:
I'm trying to compare between pointer and integer in an "IF" statement
how do I make this work?
if(patient.id != NULL){
}
Thanks
Chris
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |