C Programming - Functions - Discussion
Discussion Forum : Functions - General Questions (Q.No. 3)
3.
How many times the program will print "IndiaBIX" ?
#include<stdio.h>
int main()
{
printf("IndiaBIX");
main();
return 0;
}
Answer: Option
Explanation:
A call stack or function stack is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing.
A stack overflow occurs when too much memory is used on the call stack.
Here function main() is called repeatedly and its return address is stored in the stack. After stack memory is full. It shows stack overflow error.
Discussion:
31 comments Page 3 of 4.
Shiny vn said:
1 decade ago
Its a C program you may try by using some other or can try with terminals.
Kuldeep chaudhary said:
1 decade ago
What is the diff b/w
#include"...."
and
#include<....>
#include"...."
and
#include<....>
Jeff McCracken said:
1 decade ago
I think answer D should state "Until the stack DOES overflow"
Ammu said:
8 years ago
When will the answer becomes infinite times instead of stack overflow?
(1)
Ashish kumar said:
8 years ago
What gives the programme if int main replaces the void main?
Rajesh said:
9 years ago
Anybody explain it, I am in little bit in confusion.
(1)
Benito said:
8 years ago
Thank you all for the given explanation.
Dhiranjan mondal said:
5 years ago
infinite times is the correct answer.
(1)
Pari said:
1 decade ago
How can main can call main function?
Kavitha said:
7 years ago
Thank you all for explaining this.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers