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 the maximum length of an identifier?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
What is a structural principle?
What does sizeof int return?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is c language & why it is used?
ATM machine and railway reservation class/object diagram
write a program to concatenation the string using switch case?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
What is a good data structure to use for storing lines of text?
Do you know null pointer?
How can I convert a number to a string?
Explain how can type-insensitive macros be created?
Did c have any year 2000 problems?
How many types of functions are there in c?