answersLogoWhite

0


Best Answer

// declare a function

int* function(int, int);

or

int* (function)(int, int);

// declare a pointer to a function

int* (*pointer_to_function)(int, int);

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do declare function pointer having two integer parameters and returning integer pointers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is parameter in functions?

whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters.. e.g. int sum(int a,int b); here a & b are known as parameters.....


Can you declare a function in the body of another function in c language?

yes, we can not declare a function in the body of another function. but if we declare a function in the body of another function then we can call that very function only in that particular function in which it is declared; and that declared function is not known to other functions present in your programme. So if a function is required in almost all functions of your programme so you must declare it outside the main function i.e in the beginning of your programme.


How do you declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

Please ask just one question at a time!Question 1:How do you declare an array of three pointers to chars?How do you declare an array of three char pointers?Note: both of these questions are merely alternative wordings for the same question.Answer 1:char * a[3];Question 2:How do you declare a pointer to an array of three chars?Answer 2:char a[3]; // an array of three charschar * p = a; // a pointer to an array of three charsQuestion 3:How do you declare a pointer to a function which receives an int pointer?Answer 3:#include // some functions we can point at:void func_1(int * p){}void func_2(int * p){}// note: all functions we wish to point at with the same// pointer must have the same signature.int main(){int* p = NULL; // instantiate an int pointervoid (*pFunc) (int*); // declare a function pointerpFunc = func_1; // point to func_1pFunc(p); // call func_1 via function pointerpFunc = func_2; // point to func_2pFunc(p); // call func_2 via function pointerreturn(0);}Note that the brackets in the function pointer declaration are required. If you omit them, you will end up with a standard function declaration that returns a pointer to void, resulting in a compiler error.


How to create user define function of my name in c?

You need to declare it first. A function declaration is made of three parts: The kind of data the function returns, I.E. void, int, etc. The name of the function, I.E. helloWorld. The list of parameters in parentheses, I.E. (A as int, B as char) For an example, here it is: void helloWorld(); Now, to put something inside the function, you can write the following: void helloWorld() { printf("Hello world!"); }


What are default arguments in c plus plus?

Default arguments are function parameters for which a default value is implied when not explicitly stated. int foo(int x, int base=10 ) { return( x%base); } The above function assumes 'base' is 10 unless you specify otherwise when making the call. Thus calling foo(15) will return 5, as will foo(5,10), but foo(15,16) will return 15. Note that default parameters must appear after all non-default parameters in a function declaration. Once you specify a default parameter, all other parameters that follow must also have default values. Note also that when the definition of a function is split from its declaration, only the declaration should declare the default parameters: // Declaration: int foo(int x, int base=10 ); // Definition: int foo(int x, int base ) { return( x%base); }

Related questions

What is function parameters?

whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters.. e.g. int sum(int a,int b); here a & b are known as parameters.....


What are the various method to declare a function?

*Return variable type* *Function Name* (*Function parameters*) For example: int MyFunction (x,y)


What is default value of formal arguments?

In C, there is no default value for formal parameters. In C++, there can be, but the value is whatever you declare in the function declaration.


What is parameter in functions?

whatever the variables we declare in function signature to receive the arguments at the calling that are known as parameters.. e.g. int sum(int a,int b); here a & b are known as parameters.....


How do you declare an array of five pointers to chars?

char *p="ragav"


How will you declare an array of three function pointers where each function receives two int and returns float?

typedef float (*pt_func)(int, int); pt_func arr[3];another way:float (*pt_func[3])(int, int);


How can you declare a pointer function?

*function();this declares a pointer function!


Can you declare a function in the body of another function in c language?

yes, we can not declare a function in the body of another function. but if we declare a function in the body of another function then we can call that very function only in that particular function in which it is declared; and that declared function is not known to other functions present in your programme. So if a function is required in almost all functions of your programme so you must declare it outside the main function i.e in the beginning of your programme.


How do you declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

Please ask just one question at a time!Question 1:How do you declare an array of three pointers to chars?How do you declare an array of three char pointers?Note: both of these questions are merely alternative wordings for the same question.Answer 1:char * a[3];Question 2:How do you declare a pointer to an array of three chars?Answer 2:char a[3]; // an array of three charschar * p = a; // a pointer to an array of three charsQuestion 3:How do you declare a pointer to a function which receives an int pointer?Answer 3:#include // some functions we can point at:void func_1(int * p){}void func_2(int * p){}// note: all functions we wish to point at with the same// pointer must have the same signature.int main(){int* p = NULL; // instantiate an int pointervoid (*pFunc) (int*); // declare a function pointerpFunc = func_1; // point to func_1pFunc(p); // call func_1 via function pointerpFunc = func_2; // point to func_2pFunc(p); // call func_2 via function pointerreturn(0);}Note that the brackets in the function pointer declaration are required. If you omit them, you will end up with a standard function declaration that returns a pointer to void, resulting in a compiler error.


What you declare in the function prototype in c?

yes


How to create user define function of my name in c?

You need to declare it first. A function declaration is made of three parts: The kind of data the function returns, I.E. void, int, etc. The name of the function, I.E. helloWorld. The list of parameters in parentheses, I.E. (A as int, B as char) For an example, here it is: void helloWorld(); Now, to put something inside the function, you can write the following: void helloWorld() { printf("Hello world!"); }


What are default arguments in c plus plus?

Default arguments are function parameters for which a default value is implied when not explicitly stated. int foo(int x, int base=10 ) { return( x%base); } The above function assumes 'base' is 10 unless you specify otherwise when making the call. Thus calling foo(15) will return 5, as will foo(5,10), but foo(15,16) will return 15. Note that default parameters must appear after all non-default parameters in a function declaration. Once you specify a default parameter, all other parameters that follow must also have default values. Note also that when the definition of a function is split from its declaration, only the declaration should declare the default parameters: // Declaration: int foo(int x, int base=10 ); // Definition: int foo(int x, int base ) { return( x%base); }