why tell "core dumped"?

why tell core dumped?
I am a new .I write a program.I use cc to complier it.
when i run it,it tell me "core dumped"?
who can tell me the reason?
the program as follow:
main()
{
char *a;
printf("please input your name:");
scanf("%s",a);
printf("\n");
printf("%s",a);
}

The crux of your problem is that a is a pointer to char, but it doesn't point to anything. You don't have a place to store your data when you read it in.

Your scanf statement is also very dangerous. It will allow any size string to be read. You need to make sure that your string will fit in the buffer that you allocate.

We are supposed to say "int main()" these days. And, if you're going to return from main, pass a return code. It will become your exit code.

You really should have a \n at the end of your last printf. Your code is legal without it, but you may not be able to see the output because your prompt may overwrite it. That is a hard bug to find.

Here is a legal program that is closest to your code:

#include <stdio.h>
int main()
{
       char a[32];
       printf("please input your name -");
       scanf("%31s", a);
       printf("\n");
       printf("%s\n", a);
       return 0;
}

First of all,thank you very much.
All you said that I have understand.
I am a newer.Could you recommend some books about c progra in
unix.
thank you for you help

I too am learning C...I have benefitted from a couple of books..

C Primer Plus
Synopsis
The Waite Group's C Primer Plus, Third edition, presents the ANSI C standard beginning with a discussion of the fundamentals of C programming and then continues on to illustrate real-world C programming concepts and techniques. The Waite Group's C Primer Plus, Third Edition, is jam-packed with hundreds of sample programs, challenging yet humorous examples, hints and quizzes. Get the latest information on migrating from C to C++ and find out what will change with the release of the new C ANSI/ISO standard. Learn the mechanics of C programming and how to create programs that are easy to read, debug and update using real-world, easy-to-follow examples.

and

The C Programming Language by Kernighan & Rictchie (this is said to be the C Bible. It makes for a great reference book and a good supplement to the primer book that I use.)

Good Luck.