
Hi,
Pls any body help, why the following prog crashing while running.
#include<stdio.h>
#include<conio.h>
int main(){
int n,*fact(int *n);
printf("Enter the number:");
scanf("%d",&n);
printf("The factorial is %d\n",*fact(&n));
getch();
}
int *fact(int *p){
int *res;
if(*p == 1)
return(&1);
else{
*res = (*p)-- * *fact(p);
}
return(&res);
}
Thanks Venkii.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.