answersLogoWhite
Computer Viruses
Computer Programming
C Programming

What is pointer to function in c?


Top Answer
User Avatar
Wiki User
Answered 2009-07-25 07:10:45

Pointer in C is Memory Reference. It stores memory address of any variable, constant, function or something you later use in your programming. Pointer basically used to ease the referencing of variables and others or in polymorphism and inheritance.

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Related Questions


Yes, C++ supports function pointers.


Usable. A prominent example is param argv of function main.


The function ftell returns the position of the file pointer for a file.


A pointer to a function is the memory address that stores the address of a function, while the pointer itself is a function pointer.A pointer to a function might be defined as "int (*pf)(int, int);", while to actually point to the function, you would use a function pointer, such as "pf = &func;".


function pointer is a variable that hold the address of any function which declared in the program but function pointer is the array of the function that accept the run time size of the function.


An address in C or C++ is the location in memory of an object or function. An address is the contents of a pointer, as opposed to the contents of the memory location pointed to by the pointer.


There is no similarity between the two.



function does't return more then one value at a time.its needs pointer for such case.


Every non-static member function has a hidden pointer parameter named this which refers to the instance of the class the function was invoked against. For a given class, C, the type of the hidden this pointer is const C* but if the function is declared const, the pointer is const C* const. When referring to any class member, m, from within any non-static member function, this->m is implied.


*function();this declares a pointer function!


Nothing. You might have meant pointer-to-function.


Pointer variables and function pointers are the two primary types, as well as a void pointer (unknown type). Pointer variables can point to any valid type, including primitive types and user-defined types, as well as other pointer variables. Function pointers can point to any function with the same signature as the function pointer itself. Void pointers can point anywhere.


void as function return-type means no return value void as function parameter means no parameter void * as pointer type means generic pointer


as function data type: no value returned (eg: void exit ()) as function parameter: no parameters (eg: getpid (void)) as pointer: generic pointer (void *genptr)



Yes. A function can return a pointer... const char* GetHelloString() { return "Hello!"; } ... returns a pointer to the string "Hello!".


By reference. The name of the string is converted to a pointer (in C/C++) and given to the function as the address of the first element. (In Java, all objects are passed by reference, and there are no pointers.)


pointer is used when we want to retain the change in values between the function calls. Similarly double pointer is used when we want to retain the change in pointers between the function calls. If you want to modify pointers than you need double pointer to retain the change.


A pointer in C is a pointer. Examples: int *intptr; char *charptr; int (*funptr)(int, char **);


You don't use 'VOID', but 'void'. It means different things, such as:- void as function type means no return value- void as function parameter means no parameters- 'void *' as pointer-types means generic pointer


Yes. For example, argv parameter of function mainis a pointer to an array of pointers to characters.


typedef int (*myfunptr)(int argc, char **argv); myfunptr m= main;


pointer in C have following advantages- 1.Pointer is a very useful concept for creating the important C data structures i.e. linked list, stack, queues and trees, which are very powerful in certain situations. 2.Pointers are very useful when we have to reflect more than one variable change in the calling function after call takes place i.e. though we can not return more than one value from a called function but we can always pass references (pointer variables) to the variables in calling function as parameters to the function.So all the manipulation using these pointer variables will be reflected in called funtion. 3.Pointer provides a lower level view of memory, it adds to our understanding of the things going on in your computer memory.


It is to show you that the pointer is on the zero mark.



Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.