CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.
Answers were Sorted based on User's Feedback
Answer / rg
no!!! we cant define a func. inside a func.
Why u some people misguide others!!
go thru practice..
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anil kumar nahak
Yes we define any function(without main()) with in a function.
| Is This Answer Correct ? | 3 Yes | 4 No |
Answer / punam
Thank you all. This was helpful to me. So, to summarize all this should I say:
1. In C, we cannot define a function inside another function.
2. However, main() function is an exception as we can define another function inside a main() function. This can be called nesting of function inside main(). The inner function cannot be called from any outside function. It can be called only from main().
3. The only way to access the inner function from outside main() is by passing a function pointer of type inner function.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / vrushali
Hi friends , it possible.
Please chk this simple program:
#include <stdio.h>
int main ()
{
int func1 ()
{
printf ("\n Inside func 1 ");
}
func1 ();
}
O/P : Inside func 1
| Is This Answer Correct ? | 9 Yes | 17 No |
Answer / kojo maxwell
yes a function can be defined in a function.
for example;
int main()
{
}
int main is a function and in the curly brackets we could
still have functions.
| Is This Answer Correct ? | 16 Yes | 51 No |
difference between semaphores and mutex?
What is string in c language?
write a program to add two numbers of any size.....(remember any size)
What is the use of ?
Explain setjmp()?
when i declare as: void main() { clrscr(); int a=10; printf("%d",a) } my problem that why generate a error in above programs. please tell me answer seriously .
why we wont use '&' sing in aceesing the string using scanf
#include<stdio.h> #include<conio.h> struct stu { int i; char j; }; union uni { int i; char j; }; void main() { int j,k; clrscr(); struct stu s; j=sizeof(s); printf("%d",j); union uni u; k=sizeof(u); printf("%d",k); getch(); } what is value of j and k.
Write a c program to read a positive number and display it in words.? ex: 123=one two three help me....
Write a program on swapping (100, 50)
What is c preprocessor mean?
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)...