#include<stdio.h>
void f(void)
{
int s = 0;
s++;
if(s == 10)
return;
f();
printf("%d ", s);
}
int main(void)
{
f();
}
what is the output of the programme!??
i m segmentation fault …what is it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The problem here is that you’re not statically initializing
s. So it’ll always start off as 0 every time you callf(), andf()keeps calling itself over and over again butif(s == 10)is never met. The call stack eventually overflows and boom, segmentation fault.