Code:#include "stdio.h" void fun(char *pa) { strcpy(pa,"MyString"); } int main() { //char *a="hello"; // case 1 char a[5]="hello"; // case 2 fun(a); printf("%s",a); return 0; }
In the above code, case 2 gives the output "MyString" its ok.but why is case 1 giving segmentation fault?
Thanks and Regards,
Alxpo