I did some testing with the codes that I had and found out that it works untill I input to many characters, everything below eight chars and it will work fine everything else and it will stop working (winxp error).
Code:
#include <stdio.h>
int main(void)
{
char name[10];
printf("Name: ");
scanf("%s", name);
printf("Hallo %s\n", name);
system("pause");
return 0;
}
Code:
#include <stdio.h>
int main(void)
{
char *name;
printf("Name: ");
scanf("%s", &name);
printf("Hallo %s\n", &name);
system("pause");
return 0;
}
These where the codes I used. I'm not sure about this but I think this is why it is a good thing to use the malloc() function, it will take care of the memory allocation in some way (wich I don't know yet, never used the function, but I will).
Jst.
<edit>
I tested the program again a couple of times, and even used the example with the malloc function, but it still gives the winxp error at the return 0; part i think, because he does executes the system("pause"), but when I press a button it stops running.
</edit>