why this program not work? i can't use pointer as a string.Code:#include<stdio.h> #include<string.h> int main() { char *p; printf("enter some thing:"); gets(p); printf("you have typed:%s\n",p); }
output this program is
enter some thing:raihan
Segmentation fault (core dumped)
i get all time this error "Segmentation fault (core dumped)" error all-time if i use pointer as a string. how i solve this problem? am using code-blocks on Linux mint13 KDE.