How do you initialize function pointers? Give an example?
Answers were Sorted based on User's Feedback
Initialisation can be done in the following way.
func(int a,int b);
*pfunc(int a, int b);
main()
{
/*here the starting address of the function can be assigned
to a function pointer of the same type*/
pfunc = func;
....
....
....
}
func(int a, int b)
{
....
....
....
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / preeti singh
for e.g. if we have to declare a pointer to a function , the
signature of which is :
int add(int a,int b)
then a pointer to the above function can be declared as:
int (*myptr)(int ,int);
here myptr is a pointer which can point to any function that
takes 2 int args and returns an int value.
| Is This Answer Correct ? | 1 Yes | 1 No |
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
1 Answers 91mobiles, Amazon, App Guruz, College School Exams Tests, Folio3, Infosys, Omega, Planin, Riphah International University, Subex,
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
Can you write the algorithm for Queue?
0 Answers College School Exams Tests, TCS,
If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
Write a program to print “hello world” without using semicolon?
how to calculate the time complexity of a given algorithm? pls give exaples..mainly for the coplexities such as O(log n),O(n log n)...
Can we declare variables anywhere in c?
1 What is a Data Structure?
Who is the founder of c language?
Explain union.
What is f'n in math?