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 PROGRAM TO PRINT THE FOLLOWING OUTPUTS USING FOR LOOPS. A) * B) ***** *** * * ***** * * *****
O,T,T,F,F,S,S,E,N,?,?,?,T,F,F,S,S,E,N
What is the acronym for ansi?
What is the use of structure padding in c?
I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed
code for replace tabs with equivalent number of blanks
What are the 5 elements of structure?
write a program in c language to print your bio-data on the screen by using functions.
I have a function which accepts a pointer to an int. How can I pass a constant like 5 to it?
Write a program to show the workingof auto variable.
write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A
17 Answers ABC, College School Exams Tests,
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.