Segmentation Problem

John Fine
Mon Sep 15 18:25:00 GMT 2008

K. Srinivasa Chary wrote:
>  char *s="",t;
>  scanf("%s",s);
You haven't really provided a place for scanf to store its output.

char *s="";

Makes s equal to a pointer to a single byte of 0 stored somewhere in 
memory (potentially shared with "" or even other strings elsewhere in 
your program).  It is NOT a buffer you are permitted to overwrite.

More information about the Gcc-help mailing list