C Programming - Functions - Discussion

Discussion Forum : Functions - True / False Questions (Q.No. 1)
1.
A function cannot be defined inside another function
True
False
Answer: Option
Explanation:

A function cannot be defined inside the another function, but a function can be called inside a another function.

Discussion:
12 comments Page 2 of 2.

Satakshi said:   7 years ago
int main()
{
int fun();
int i;
i = fun();
printf("%d\n", i);
return 0;
}
int fun()
{
_AX = 1990;
}

fun() is declared inside main(). Can this be done?

Kunj said:   6 years ago
{
int sum(int,int) ;//function declaration
int a=5,b=6,c;
c=sum(a,b); //calling and assigned to c
printf("%d", c) ;
return 0;
}
int sum(int a, int b) //function definition
{
return (a+b) ;
}

Am I right?


Post your comments here:

Your comments will be displayed after verification.