hi guyz...
here's a pretty silly doubt that's been lingering fr a while..
why does the following code not work??

func()
{
 char *s;
 char a='x';
 char b='y';

 *s=a;
 s++;
 *s=b;

cout<<s;
}

the program comes to halt inappropriately on running the above...
can someone please explain the fault...

I think the pointer is not initialized so when you try to dereference it the first time *s = a; it crashes. Setting s = &a; in conjunction with s = &b; after incrementing the pointer also works. Your cout should be dereferenced to view the char.