Answer Posted / mohan
In C There are different types of error like
1.compile time error
2.Linker error
3.Run time error
4.Logical error
The sigmentation fault comes under Run tile error.
Let see a simple example
#include<stdio.h.
int main()
{
int i;
scanf("%d",i);
printf("%d",i);
return(0);
}
if you compile this program ,compiler can't report any
error.If you run this program in Linux Platform you got
sigmentation fault error.
This is because ,in scanf() function call instead passing
the address of the variable ,value of variable is going to
scanf() .so you got this error.
In Linux sigmentation fault is run time error reported by
memory management.
most of the time this error occurs at illegal memory access.
Is This Answer Correct ? | 34 Yes | 7 No |
Post New Answer View All Answers