What is Function Pointer? Explain with example?
Answers were Sorted based on User's Feedback
Answer / inderchauhan
A pointer is a special kind of variable in C and C++ that
holds the address of another variable.
my first pointer
#include <iostream>
using namespace std;
int main ()
{
int firstvalue, secondvalue;
int * mypointer;
mypointer = &firstvalue;
*mypointer = 10;
mypointer = &secondvalue;
*mypointer = 20;
cout << "firstvalue is " << firstvalue << endl;
cout << "secondvalue is " << secondvalue << endl;
return 0;
}
firstvalue is 10
secondvalue is 20
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sanjay bhosale
function pointer is simply a pointer which holds the address of the function so we can call that function by using pointer.
It is helpful in situations where we are required to pass the function pointer as parameter to some previously defined functions.
for e.g.
in comparison method we may pass function pointer for function which will compare 2 items/objects and help to comparison method.
| Is This Answer Correct ? | 0 Yes | 0 No |
which one is not preprocessor directive a)#if b)#elif c)#undef d)#pragma
16 Answers Accenture, Infosys, TCS, Wipro,
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
What is the use of f in c?
What is new line escape sequence?
Differentiate call by value and call by reference?
write a c program for print your name .but,your name may be small letter mean print a capital letter or your name may be capital letter mean print a small letter .example \\enter ur name : sankar The name is: SANKAR (or) enter your name:SAnkar The name is:saNKAR
What is storage class?
Is c functional or procedural?
Can we initialize extern variable in c?
Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?
in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?
I need a sort of an approximate strcmp routine?