Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Functions
What will be the output of the program? #include
void fun(int); typedef int (*pf) (int, int); int proc(pf, int, int); int main() { int a=3; fun(a); return 0; } void fun(int n) { if(n > 0) { fun(--n); printf("%d,", n); fun(--n); } }
0, 2, 1, 0,
1, 1, 2, 0,
0, 1, 0, 2,
0, 1, 2, 0,
Correct Answer:
0, 1, 2, 0,
← Previous Question
Next Question→
More Questions from
Functions
What will be the output of the program? #include
int check (int, int); int main() { int c; c = check(10, 20); printf("c=%d\n", c); return 0; } int check(int i, int j) { int *p, *q; p=&i; q=&j; i>=45? return(*p): return(*q); }
What will be the output of the program? #include
int check(int); int main() { int i=45, c; c = check(i); printf("%d\n", c); return 0; } int check(int ch) { if(ch >= 45) return 100; else return 10; }
What will be the output of the program? #include
#include
int main() { int i=0; i++; if(i<=5) { printf("CuriousTab"); exit(1); main(); } return 0; }
In C all functions except main() can be called recursively.
Functions cannot return more than one value at a time
A function cannot be defined inside another function
If return type for a function is not specified, it defaults to int
A function may have any number of return statements each returning different values.
Functions can be called either by value or reference
Names of functions in two different files linked together must be unique
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments