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
what is different between auto and local static? why should we use local static?
Why is it that not all header files are declared in every C program?
What is the argument of a function in c?
What is %d used for?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is an endless loop?
Explain what is the use of a semicolon (;) at the end of every program statement?
What is binary tree in c?
Explain what is a static function?
What are the features of the c language?
Suggesting that there can be 62 seconds in a minute?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
How to declare a variable?
Why should I prototype a function?
Explain enumerated types.