#include <stdio.h>
char *x(void){
char *c;
strcpy(c,"test" );
printf("%s",c);
return (c);
}
int main(void){
char *p;
p=x();
printf("%s",p);
return 1;
}
-bash-2.05b$ !g
gcc func.c
-bash-2.05b$ ./a.out
Segmentation fault (core dumped)
Any Idea?
Thanks
Jabir
char *x(void){
char *c;
strcpy(c,"test" );
printf("%s",c);
return (c);
}
int main(void){
char *p;
p=x();
printf("%s",p);
return 1;
}
-bash-2.05b$ !g
gcc func.c
-bash-2.05b$ ./a.out
Segmentation fault (core dumped)
Any Idea?
Thanks
Jabir
Comment