Doubt in pointing a variable in c.
Check these codes...
#include<stdio.h>
void main()
{
int *x,p=4;
x=&p;
printf("%d",*x);
}
and the 2nd one goes here...
#include<stdio.h>
void main()
{
char c[]="mohit kumar singh";
char *str;
str=&c;
printf("%s",*str);
}
from the first program i got the output "4".But don't know why 2nd one will show an Segmentation fault.
Can anyone tell me the reason for this Segmentation fault...?