Is main() is used in the program,,see below example?
void main()
{
int i;
for(i=0;i<10;i++)
main();
}
Then what is the output of the program?
Answers were Sorted based on User's Feedback
Answer / sai
The given program is an infinite loop with no
output.Because it calls main() function with in the for
loop.
So the value of the i always '0' only.According to the for
loop condition the execution of the program goes false only
i>=10.Then when the condition in the for loop goes to false?
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anbu sankar
Always i value is zero.
This program comes under recusive concept.
In stack memory,always remaining statement address [(i.e)
after main]is stored.
so at one stage stack is filled by addresses. so
Segmentation falut...
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / kalyan chukka
Loop will Repeated 10 times .in this program main function
is called it self 10 times.So the loop will repeated 10 times
| Is This Answer Correct ? | 1 Yes | 4 No |
What is static and auto variables in c?
What's a "sequence point"?
How is actual parameter different from the formal parameter?
What are pointers really good for, anyway?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
Explain how can you avoid including a header more than once?
What is pointer to pointer in c language?
List out few of the applications that make use of Multilinked Structures?
While(1) { } when this loop get terminate is it a infinite loop?
what is difference between array,strutter,union and pointers
3 Answers CTS, Lovely Professional University, Mannar Company,
#include<stdio.h> main() { char *p1; char *p2; p1=(char *) malloc(25); p2=(char *) malloc(25); strcpy(p1,"Ramco"); strcpy(p2,"Systems"); strcat(p1,p2); printf("%s",p1); } Tell me the output?
Expand the following LKB BKL FFG