Answer Posted / shiva
No.
in g++ you will be clearly notified that you can't define a
function inside another function
but gcc somehow allows following
#include <stdio.h>
int func2(int (*f)()){
(*f)();
return 0;
}
int main ()
{
int func1 ()
{
printf ("\n Inside func 1 ");
return 0;
}
printf("someting");
func1 (); //you can access this fuction inside
main(the function in which you declared func1) with the name
func1
func2(func1); // to access this function outside use
fucntion pointer as a argument
return 0;
}
o/p:
something
Inside func 1
Inside func 1
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Tell me when is a void pointer used?
which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +
I need previous papers of CSC.......plz help out by posting them.......
Why & is used in scanf in c?
What’s the special use of UNIONS?
How does free() know explain how much memory to release?
Can the sizeof operator be used to tell the size of an array passed to a function?
How can I find out the size of a file, prior to reading it in?
What is the difference between formatted&unformatted i/o functions?
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
What is a c token and types of c tokens?
Who developed c language?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
How can I call fortran?