consider the code
#include
int main(void)
{
char* a;
scanf(\"%s\",a);//&a and &a[0] give same results-crashes
printf(\"%s\",
scanf needs a place where to put the characters it reads. You can pass it a pointer to a character array (what you do in your second example), or a pointer to some memory obtained in another way (say malloc()). In your first example, you pass it an uninitialized pointer, thus the problems you are observing.